home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / basic / svgaqb21.zip / SVGABC21.TXT < prev    next >
Text File  |  1994-05-09  |  194KB  |  10,928 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.                   REFERENCE MANUAL
  9.  
  10.  
  11.                    FOR SVGAQB.LIB
  12.  
  13.  
  14.                    AND SVGAPV.LIB
  15.  
  16.  
  17.                     THE SUPER VGA
  18.  
  19.  
  20.                   GRAPHICS LIBRARY
  21.  
  22.  
  23.                    TO BE USED WITH
  24.  
  25.  
  26.                 MICROSOFT QUICKBASIC,
  27.  
  28.  
  29.                 VISUAL BASIC FOR DOS
  30.  
  31.  
  32.                    AND BASIC PROFESSIONAL
  33.  
  34.  
  35.                  DEVELOPMENT SYSTEM
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.       1993-1994 by Zephyr Software - Stephen L. Balkum and Daniel A.
  58.       Sill
  59.  
  60.       All rights reserved.  No part of this book shall be reproduced or
  61.       transmitted by any means, electronic, mechanical, photocopying,
  62.       recording or otherwise, without written permission from Zephyr
  63.       Software - Stephen L. Balkum and Daniel A. Sill.
  64.  
  65.       Although every effort has been made to insure the accuracy of the
  66.       material in this book, Zephyr Software, Stephen L. Balkum and
  67.       Daniel A. Sill assume no responsibility for errors or omissions.
  68.       In addition no liability is assumed for damages resulting from
  69.       the use of the information contained herein.
  70.  
  71.       Printed in the United States of America
  72.  
  73.       Trademarks
  74.  
  75.       The Graphics Interchange Format (c) is the Copyright property of
  76.       CompuServe Incorporated.
  77.       GIF (sm) is a Service Mark property of CompuServe Incorporated.
  78.       Sound Blaster and Sound Blaster Pro are trademarks of Creative
  79.       Labs, Inc.
  80.       All others are trademarks of their respective owners.
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.                                      ii
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.                  SOFTWARE LICENSE AGREEMENT
  108.  
  109.            By using this software, you agree to the terms of this
  110.                      agreement.
  111.  
  112.            No warranties are expressed or implied.  In no event
  113.            shall Zephyr Software, Stephen L. Balkum or Daniel A.
  114.            Sill be held liable for damages resulting from the use
  115.            or misuse of this product, including but not limited to
  116.            implied warranties of fitness for a particular purpose.
  117.  
  118.            The shareware version may be freely distributed as long
  119.            as all files stay together and are not modified in any
  120.            way.  No cost may be charged for the shareware version
  121.            beyond normal and reasonable copying and distribution
  122.            expenses.
  123.  
  124.            No products developed with this software shall be sold
  125.            unless this software has been registered with Zephyr
  126.            Software, Stephen L. Balkum or Daniel A. Sill.
  127.  
  128.            At no time for any reason shall this software be
  129.            reverse engineered, decompiled or disassembled.
  130.  
  131.            This software may not be rented or leased.
  132.  
  133.            This software may be used only on one terminal or one
  134.            computer at any one given moment in time.  This
  135.            software may not be installed on a network of any type.
  136.            Contact Zephyr Software, Stephen L. Balkum or Daniel A.
  137.            Sill for networking options.
  138.  
  139.            United States Government Restricted Rights:
  140.            Use, duplication or disclosure of this software and
  141.            documentation by the U.S. Government is subject to the
  142.            restrictions as set forth in subparagraph (c)(1)(ii) of
  143.            the Rights in Technical Data and Computer Software
  144.            clause at DFARS 252.227-7013.  Contractor/manufacturer
  145.            is Stephen L. Balkum and Daniel A. Sill, P.O. Box 7704,
  146.            Austin, Texas 78713-7704.
  147.  
  148.            The ownership of this software may be transferred as
  149.            long as Zephyr Software, Stephen L. Balkum or Daniel A.
  150.            Sill is notified in writing of the transfer date and
  151.            new owner.  The new owner must agree to this contract.
  152.            The transfer must include all registered updates and
  153.            previously registered versions.  The original owner may
  154.            not retain any copies in any form of the registered
  155.            software or its documents.
  156.  
  157.  
  158.  
  159.  
  160.  
  161.                                     iii
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.       INTRODUCTION
  169.  
  170.       We spent weeks searching the depths of the internet ftp sites for
  171.       a library that would allow the programmer full access to the
  172.       abilities of Super VGA.  We wanted the colors VGA could provide
  173.       and better resolution than EGA could provide.  Professionally
  174.       developed libraries with this ability were definitely out of our
  175.       price range.  After our searches continuously returned nothing,
  176.       we decided to fill the apparent void in the shareware market.
  177.  
  178.       Our searches did give two useful packages:  John Bridges' VGAKIT
  179.       and Finn Thoegersen's VGADOC.  We began with these two works and
  180.       developed a graphics library intended to allow the programmer
  181.       access to the huge world of high resolution programming.
  182.  
  183.       On the surface the task appeared quite simple.  However, it
  184.       quickly became obvious that the routines in this library would be
  185.       required to affect extremely large amounts of data.  Operations
  186.       must be quick to be successful.  Therefore, every effort was made
  187.       to create the fastest code possible - even at the expense of
  188.       size.  For this reason we opted to write code with the 32 bit
  189.       instructions of the 80386 and 80486 chips.  It is our opinion
  190.       that anyone with a hi-res card in a lesser machine may have some
  191.       priorities out of order. All routines are written in assembly and
  192.       use absolutely no floating point values.  Anytime a real number
  193.       was required, fixed point notation was used.  In addition we
  194.       attempted to write the routines such that any reasonable argument
  195.       passed can be interpreted intelligently by the library.
  196.  
  197.       With the numerous Super VGA cards available and no well
  198.       established standard we chose John Bridges' identification and
  199.       bank switching routines as a beginning.  These two routines have
  200.       undergone some modification, but not enough to justify
  201.       copyrighting this portion of the library's code by Zephyr
  202.       Software.  We have no intentions of releasing our changes to
  203.       these routines into the public domain.  From that point onward
  204.       all code is original.  In some instances common algorithms were
  205.       researched and original code written according to that algorithm.
  206.  
  207.       This Super VGA library gives the programmer transparent access to
  208.       twenty different Super VGA cards.  These cards include Acumos,
  209.       Ahead, ATI Technologies, Avance, Chips and Technologies, Cirrus
  210.       Logic, Everex, Genoa, MXIC, NCR, Oak Technologies,
  211.       Paradise/Western Digital, Primus, Realtek, Trident, Tseng Labs,
  212.       Video 7 and the VESA standard.  Please see the WHICHVGA function
  213.       for the specific chipsets.  The programmer only needs to verify
  214.       that the end user's card has been identified, but not which card
  215.       was recognized.  After proper identification, all functions react
  216.       in exactly the same fashion.  The library contains functions to
  217.       draw all of the major primitives.  In addition there are
  218.       functions that modify the screen palette, write text on the
  219.       screen with a choice of fonts and modify the reaction of the
  220.       primitives.  Identification routines include not only the video
  221.       card, but also the amount of video memory, type of processor and
  222.  
  223.  
  224.                                       2
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.       installed pointing devices.  Advanced functions provide full
  232.       mouse support (when used with a Microsoft compatible driver) and
  233.       joystick support.  Finally, support for two dimensional and three
  234.       dimensional coordinate systems is provided including rotation,
  235.       translation, scaling and projection.
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.                                       3
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.       SUGGESTED METHODS FOR USING THIS LIBRARY
  295.  
  296.       USE WITHIN THE BASIC ENVIRONMENT
  297.  
  298.       We assume that the programmer is familiar with all of the
  299.       capabilities of the Microsoft QuickBasic, Visual Basic (VBDOS) or
  300.       Basic Professional Development System (PDS) compiler and
  301.       environment.  Understanding of the LIB and LINK commands is
  302.       encouraged as well as the use of QuickLibraries.  However, to
  303.       ensure you are able to get up and running quickly, the following
  304.       commands may be helpful:
  305.  
  306.       To create a QuickLibrary from SVGAQB/PV.LIB, type the command:
  307.  
  308.           LINK /QU SVGAQB/PV.LIB, SVGAQB/PV.QLB, NUL, QUICKQLB.LIB
  309.  
  310.       where QUICKQLB.LIB is the name for your compiler's QuickLibrary
  311.       (BQLB45.LIB for QuickBasic 4.5, VBDOSQLB.LIB for VBDOS and
  312.       QBXQLB.LIB for PDS).
  313.  
  314.       If you wish to create a QuickLibrary from SVGAQB/PV.LIB and
  315.       additional libraries, type the command:
  316.  
  317.           LINK /QU SVGAQB/PV.LIB + ????.LIB (continue as desired),
  318.                 NEWLIB.QLB, NUL, QUICKQLB.LIB
  319.  
  320.       where QUICKQLB.LIB is the same as above and ????.LIB represents
  321.       the additional desired libraries.
  322.  
  323.       After the QuickLibrary has been created, you should start your
  324.       development environment by typing:
  325.  
  326.             QuickBasic:    QB /L SVGAQB
  327.             VBDOS:         VBDOS /L SVGAPV
  328.             PDS:           QBX /L SVGAPV
  329.  
  330.       This will tell the compiler to use the QuickLibrary when running
  331.       and when creating an executable.
  332.  
  333.       VERIFICATION OF A COMPUTER'S HARDWARE
  334.  
  335.       It is strongly recommended that any program written with this
  336.       library first verifies that the computer is a 80386 or better by
  337.       calling the WHICHCPU function.  Many of the library's functions
  338.       use 386 exclusive code which may cause a computer with a lesser
  339.       processor to crash.  In addition WHICHMOUSE must be called before
  340.       calling any of the mouse functions.  Lastly, it is recommended
  341.       that WHICHJOYSTICK be called before a program uses the joystick
  342.       routines.
  343.  
  344.       It is required that a program call WHICHVGA prior to any function
  345.       that communicates with the video card.  If WHICHVGA returns a
  346.       zero for unknown card type, the program should not call any
  347.       graphics function.  Without proper identification of the video
  348.  
  349.  
  350.                                       4
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.       card any graphics function will likely cause a system failure.
  358.       It is recommended, although not necessary, that a program call
  359.       WHICHMEM prior to calling any RES function.  Although the video
  360.       card was properly identified, it may not have sufficient onboard
  361.       memory to support the desired resolution.  As a second check the
  362.       RES functions will do nothing if the video card has not been
  363.       identified or if the video card does not support the specified
  364.       resolution for memory or hardware reasons.
  365.  
  366.       THE 256 COLOR PALETTE
  367.  
  368.       The 256 color palette of the Super VGA cards is a six bit
  369.       palette.  Each of the 256 colors of the palette are described by
  370.       three values representing the intensity of the colors red, blue
  371.       and green.  These values can range from 0 to 63.  Anytime a value
  372.       outside of this range is used, the video card simply ignores the
  373.       upper two bits.  Therefore, 64 is the same as 0.  This should be
  374.       taken into consideration when manipulating the palette or when
  375.       importing a palette from an external source such as a GIF image.
  376.  
  377.       USE OF 2-D AND 3-D FUNCTIONS
  378.  
  379.       In the interest of speed, the 2-D and 3-D functions were written
  380.       to best work on multiple points at once.  We refer to these
  381.       functions as object-oriented.  This means that the points
  382.       defining an object (a box, a house, etc.) should be contained
  383.       within one array or part of an array and calls to the functions
  384.       should act on all of the points in the array.  Calls to functions
  385.       have a high speed overhead, therefore, placing more than one
  386.       object in the same array and passing the entire array to the
  387.       functions can be beneficial.  However, these functions will work
  388.       on a single point as well.
  389.  
  390.       Another consequence of our object-oriented 2-D and 3-D functions
  391.       is the use of the scaling functions.  When scaling objects, we
  392.       recommend the object be defined about the origin.  D2SCALE and
  393.       D3SCALE both work with respect to the origin.  This eliminates a
  394.       significant number of translations that would otherwise be
  395.       required by having a definable scale origin.  For example, to
  396.       draw two boxes, one scaled by one-half of the other, each rotated
  397.       by 45 degrees at the center of the screen, the recommended
  398.       procedure is as follows:
  399.  
  400.         define an array BOX containing the 2-D points: (100, 100), (-
  401.            100, 100), (-100, -100), (100, -100), (note: the box is
  402.            centered about the origin.)
  403.         rotate BOX by 45 degrees about (0, 0) and place the output in
  404.            RBOX,
  405.         scale RBOX by 50% (scaling factor would be 128, or 80 hex) and
  406.            place output in SRBOX,
  407.         translate RBOX to the center of the screen - a translation of
  408.            320, 240 in 640x480 resolution - and place output in TRBOX,
  409.         translate SRBOX to the center of the screen - same translation
  410.            as for RBOX - and place output in TSRBOX,
  411.  
  412.  
  413.                                       5
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.         draw TRBOX and TSRBOX on the screen.
  421.  
  422.       Notice that by defining the box centered about the origin the
  423.       translation values were extremely intuitive.  Also notice that if
  424.       we had scaled the second box after the translation, it would have
  425.       been draw in the upper left quadrant of the screen instead of the
  426.       center.
  427.  
  428.       In mathematics and many sciences it is customary that in a 2-D
  429.       coordinate system the Y axis increases upward and the X axis
  430.       increases to the right.  The computer industry has decided the Y
  431.       axis should increase downward.  The 2-D functions are not
  432.       affected by the choice in coordinate systems.  However, it is
  433.       important to remember that a positive rotation in D2ROTATE
  434.       rotates from the positive X axis to the positive Y axis.
  435.       Therefore, when using mathematical conventions, a positive
  436.       rotation moves counter-clockwise.  On the computer screen a
  437.       positive rotation moves clockwise.
  438.  
  439.       The 3-D coordinate system follows mathematical conventions by
  440.       using a right-handed coordinate system.  The easiest way to
  441.       visualize this coordinate system is by using your right hand.
  442.       Place your index finger and thumb at a right angle to one another
  443.       as if to form an imaginary pistol.  Now place your second finger
  444.       at a right angle to your index finger.  It should be at a right
  445.       angle to your thumb as well.  This represents the three axes.
  446.       The index finger is the X axis, the second finger is the Y axis
  447.       and the thumb is the Z axis.  The easiest way to remember
  448.       rotation directions in this system is cyclically.  A positive
  449.       rotation about the X axis rotates the Y axis into the Z axis.  A
  450.       positive rotation about the Y axis rotates the Z axis into the X
  451.       axis.  A positive rotation about the Z axis rotates the X axis
  452.       into the Y axis.
  453.  
  454.       After doing all necessary 3-D transformations, projection onto
  455.       the 2-D computer screen is required.  Although the computer
  456.       screen's coordinate system does not follow mathematical
  457.       conventions, the D3PROJECT function automatically takes care of
  458.       all conversions.  The programmer only needs to draw the resulting
  459.       object on the screen with FILLCONVEXPOLY or a series of DRWLINEs.
  460.  
  461.       THE CONCEPT OF SPRITE GRAPHICS
  462.  
  463.       The key to sprite graphics is the assumption that only a small
  464.       percentage of the pixels in a graphics block are used by the
  465.       animation and the remaining pixels should be treated as
  466.       transparent, revealing the background behind the sprite.  The
  467.       sprite routines in this library only act on non-transparent
  468.       colors, thus, saving time by ignoring a large number of pixels.
  469.       When retrieving the background for a sprite, prior knowledge of
  470.       the sprite itself permits obtaining background only where it is
  471.       necessary.
  472.  
  473.  
  474.  
  475.  
  476.                                       6
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.       The following steps outline an example of the recommended
  484.       procedure for using the sprite functions:
  485.  
  486.         1. draw the sprite on the screen - a white stick figure on a
  487.            black background, for example
  488.         2. use BLKGET to place the sprite in an array STICK
  489.         3. use SPRITEGAP to simultaneously retrieve the background into
  490.            BACKSTICK and place STICK on the screen, declaring black as
  491.            the transparent color
  492.         4. use SPRITEPUT to replace the background BACKSTICK in the
  493.            same location as step 3
  494.         5. repeat steps 3 and 4 as many times and in as many locations
  495.            as desired
  496.  
  497.       EXTENDED MEMORY SUPPORT
  498.  
  499.       With the higher screen resolutions, more memory may be needed for
  500.       data storage.  For this reason extended memory support is
  501.       provided.  Accessing extended memory requires the computer to
  502.       switch into protected mode.  The process of switching into
  503.       protected mode and returning is handled by the extended memory
  504.       manager, usually HIMEM.SYS.  The switch is relatively slow.
  505.       Therefore, it should be used as fast storage access since it is
  506.       much faster than disk access.
  507.  
  508.       Extended memory access is also limited by the number of available
  509.       handles.  The limit is controlled by a switch on the extended
  510.       memory manager's command line and normally defaults to 32.  Also,
  511.       it is imperative that all allocated extended memory blocks be
  512.       freed before the program terminates.  Unfreed memory blocks will
  513.       be unavailable until the computer is rebooted.
  514.  
  515.       CONVENTIONS USED IN THIS MANUAL
  516.  
  517.       All parameters, other than strings, passed to and from functions
  518.       and procedures in this QuickBasic library are short (two byte)
  519.       integers.  No floating point values are used.
  520.  
  521.       Whenever a pixel is written on the screen, a mode is required.
  522.       Unless otherwise noted, there are four possible modes:  SET, XOR,
  523.       OR and AND.  These modes are represented by the numbers one
  524.       through four respectively.  Technically, SET is the fastest mode.
  525.       However, XOR maybe the most useful.  XOR'ing a point twice with
  526.       the same color returns the original color.  This can be used to
  527.       cover and uncover graphics.  In addition when a reference to a
  528.       color index is made, only values between and including 0 and 255
  529.       are valid.  Any integer will work, but only the lowest eight bits
  530.       are recognized.
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.                                       7
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  
  546.       BLKGET
  547.  
  548.         PROTOTYPE
  549.  
  550.         SUB BLKGET (X1%, Y1%, X2%, Y2%, GfxBlk%)
  551.  
  552.         INPUT
  553.  
  554.         X1, Y1 - top left corner of block
  555.         X2, Y2 - bottom right corner of block
  556.  
  557.         OUTPUT
  558.  
  559.         If declared as a function, BLKGET returns 1 if successful, 0
  560.         if failed.
  561.         GfxBlk - integer destination array holding retrieved bitmap
  562.  
  563.         USAGE
  564.  
  565.         BLKGET stores the pixel data contained within the block
  566.         defined by (X1, Y1)-(X2, Y2) in the variable referenced by
  567.         GfxBlk.  GfxBlk must be dimensioned as a short integer array
  568.         with a size in integers equal to
  569.                  [(X2-X1+1)*(Y2-Y1+1)] / 2+3.
  570.  
  571.         Note, however, that GfxBlk can be quite large.  If the size of
  572.         GfxBlk is insufficient, BLKGET will overwrite any data in
  573.         memory contained beyond GfxBlk and may possibly cause the
  574.         system to crash.  BLKGET enforces X2 X1 and Y2Y1.  Also, the
  575.         coordinates must be valid on the screen at the current
  576.         resolution.
  577.  
  578.         The bitmap is stored such that the first integer in the
  579.         destination array is the width and the second integer is the
  580.         height.  The remaining bytes are the bitmap raster data stored
  581.         by rows starting at the top of the block.
  582.  
  583.         Arrays should be passed by giving the element within the array
  584.         from where the action should take place.  This allows the
  585.         programmer to store more than one item within the same array
  586.         or act on only a portion of the array.
  587.  
  588.         SEE ALSO
  589.  
  590.         BLKPUT, BLKRESIZE, BLKROTATE, GETLASTSTRING, SPRITEGAP,
  591.         SPRITEGET, SPRITEPUT
  592.  
  593.         EXAMPLE
  594.  
  595.         REM PLACES 1/4 OF A CIRCLE AT THE CENTER OF THE SCREEN
  596.         REM $INCLUDE: 'SVGABC.BI'
  597.         DEFINT A-Z
  598.         DIM BLOCKDATA(0 TO 483) AS INTEGER
  599.         IF WHICHVGA = 0 THEN STOP
  600.  
  601.  
  602.                                       8
  603.  
  604.  
  605.  
  606.  
  607.  
  608.  
  609.         DUMMY=RES640
  610.         DRWCIRCLE 1, 10, 30, 30, 20
  611.         FILLAREA 30, 30, 10, 7
  612.         BLKGET 0, 0, 30, 30, BLOCKDATA(0)
  613.         BLKPUT 1, 320, 240, BLOCKDATA(0)
  614.         WHILE INKEY$ = ""
  615.         WEND
  616.         DUMMY=RESTEXT
  617.         END
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.                                       9
  666.  
  667.  
  668.  
  669.  
  670.  
  671.  
  672.       BLKPUT
  673.  
  674.         PROTOTYPE
  675.  
  676.         SUB BLKPUT (Mode%, X%, Y%, GfxBlk%)
  677.  
  678.         INPUT
  679.  
  680.         Mode - pixel write mode (SET=1, XOR=2, OR=3, AND=4)
  681.         X, Y - location for top left corner of block
  682.         GfxBlk - integer source array
  683.  
  684.         OUTPUT
  685.  
  686.         no value returned
  687.  
  688.         USAGE
  689.  
  690.         BLKPUT places the pixel data contained in the variable
  691.         referenced by GfxBlk on the screen.  The top, left corner of
  692.         the block is specified by (X, Y).  Any (X, Y) is acceptable
  693.         and any portion of the block that lies outside of the
  694.         currently defined viewport will not be drawn.
  695.  
  696.         Arrays should be passed by giving the element within the array
  697.         from where the action should take place.  This allows the
  698.         programmer to store more than one item within the same array
  699.         or act on only a portion of the array.
  700.  
  701.         SEE ALSO
  702.  
  703.         BLKGET, BLKRESIZE, BLKROTATE, GETLASTSTRING, SPRITEGAP,
  704.         SPRITEGET, SPRITEPUT, GIFPUT, SETVIEW
  705.  
  706.         EXAMPLE
  707.  
  708.         See BLKGET
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.                                      10
  729.  
  730.  
  731.  
  732.  
  733.  
  734.  
  735.       BLKRESIZE
  736.  
  737.         PROTOTYPE
  738.  
  739.         SUB BLKRESIZE (NewXSize%, NewYSize%, SourceGfxBlk%,
  740.         DestGfxBlk%)
  741.  
  742.         INPUT
  743.  
  744.         NewXSize, NewYSize - size of resulting bitmap in DestGfxBlk
  745.         SourceGfxBlk - integer source array
  746.  
  747.         OUTPUT
  748.  
  749.         no value returned
  750.         DestGfxBlk - integer destination array holding resized bitmap
  751.  
  752.         USAGE
  753.  
  754.         BLKRESIZE takes the bitmap in SourceGfxBlk and scales it up or
  755.         down according the to values passed in NewXSize and NewYSize.
  756.         The resulting bitmap is returned in DestGfxBlk which should
  757.         already be declared with a size calculated according to the
  758.         equation in BLKGET.  NewXSize and NewYSize should not be zero.
  759.  
  760.         SEE ALSO
  761.  
  762.         BLKGET, BLKPUT, BLKROTATE
  763.  
  764.         EXAMPLE
  765.  
  766.         REM  RESIZE A BITMAP
  767.         REM $INCLUDE: 'SVGABC.BI'
  768.         DEFINT A-Z
  769.         DIM SRC%(0 TO 32000)
  770.         DIM DST%(0 TO 32000)
  771.  
  772.         IF WHICHCPU < 386 THEN END
  773.         IF WHICHVGA = 0 THEN END
  774.         VMODE=VIDEOMODEGET
  775.         IF RES640 <> 1 THEN
  776.         DUMMY = RESTEXT
  777.         END
  778.         END IF
  779.         X1 = 0
  780.         Y1 = 0
  781.         X2 = 50
  782.         Y2 = 50
  783.         FOR I = 0 TO 25
  784.         XA = (RND * X2 - X1) + X1
  785.         YA = (RND * Y2 - Y1) + Y1
  786.         XB = (RND * X2 - X1) + X1
  787.         YB = (RND * Y2 - Y1) + Y1
  788.         C = RND * 16
  789.  
  790.  
  791.                                      11
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.         DRWLINE 1, C, XA, YA, XB, YB
  799.         NEXT I
  800.         DRWBOX 1, 15, X1, Y1, X2, Y2
  801.         BLKGET X1, Y1, X2, Y2, SRC(0)
  802.         X1 = GETMAXX \ 2
  803.         Y1 = GETMAXY \ 2
  804.         X = SRC(0) + 1
  805.         Y = SRC(1) + 1
  806.         BLKRESIZE X, Y, SRC(0), DST(0)
  807.         BLKPUT 2, X1 - DST(0) \ 2, Y1 - DST(1) \ 2, DST(0)
  808.         FOR I = X TO X + 50
  809.         BLKPUT 2, X1 - DST(0) \ 2, Y1 - DST(1) \ 2, DST(0)
  810.         BLKRESIZE I, I, SRC(0), DST(0)
  811.         BLKPUT 2, X1 - DST(0) \ 2, Y1 - DST(1) \ 2, DST(0)
  812.         SDELAY 3
  813.         NEXT I
  814.         FOR I = X + 50 TO X - 50 STEP -1
  815.         BLKPUT 2, X1 - DST(0) \ 2, Y1 - DST(1) \ 2, DST(0)
  816.         BLKRESIZE I, I, SRC(0), DST(0)
  817.         BLKPUT 2, X1 - DST(0) \ 2, Y1 - DST(1) \ 2, DST(0)
  818.         SDELAY 3
  819.         NEXT I
  820.         FOR I = X - 50 TO X
  821.         BLKPUT 2, X1 - DST(0) \ 2, Y1 - DST(1) \ 2, DST(0)
  822.         BLKRESIZE I, I, SRC(0), DST(0)
  823.         BLKPUT 2, X1 - DST(0) \ 2, Y1 - DST(1) \ 2, DST(0)
  824.         SDELAY 3
  825.         NEXT I
  826.         VIDEOMODESET VMODE
  827.         END
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.                                      12
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.       BLKROTATE
  862.  
  863.         PROTOTYPE
  864.  
  865.         FUNCTION BLKROTATE% (Ang%, BackFillColor%, SourceGfxBlk%,
  866.         DestGfxBlk%)
  867.  
  868.         INPUT
  869.  
  870.         Ang - integer degree to rotate source bitmap
  871.         BackFillColor - index to color in current palette to fill
  872.         blank space in DestGfxBlk
  873.         SourceGfxBlk - integer source array
  874.  
  875.         OUTPUT
  876.  
  877.         BLKROTATE returns 1 if successful, 0 if unsuccessful.
  878.         DestGfxBlk - integer destination array holding rotated bitmap
  879.  
  880.         USAGE
  881.  
  882.         BLKROTATE takes the bitmap in SourceGfxBlk and rotates by the
  883.         number of degrees specified in Ang.  The bitmap rotation
  884.         algorithm is a three-pass shear technique modified to make
  885.         efficient use of this library's internal buffers.  Blank space
  886.         around the newly rotated block is filled with the color given
  887.         by BackFillColor.  The resulting bitmap is stored in
  888.         DestGfxBlk.  The size of DestGfxBlk should be at least as big
  889.         as given by BLKROTATESIZE.
  890.  
  891.         The function will fail if it calculates that the internal
  892.         buffers would be overflowed or if the destination array would
  893.         be larger than 65536 bytes.  BLKROTATESIZE should be called
  894.         first to ensure that buffer integrity is maintained.
  895.  
  896.         SEE ALSO
  897.  
  898.         BLKGET, BLKPUT, BLKRESIZE, BLKROTATESIZE
  899.  
  900.         EXAMPLE
  901.  
  902.         REM ROTATE A BITMAP
  903.         REM $INCLUDE: 'SVGABC.BI'
  904.         DEFINT A-Z
  905.         DIM SRC%(0 TO 32000)
  906.         DIM DST%(0 TO 32000)
  907.         IF WHICHCPU < 386 THEN END
  908.         IF WHICHVGA = 0 THEN END
  909.         VMODE = VIDEOMODEGET
  910.         IF RES640 <> 1 THEN
  911.         DUMMY = RESTEXT
  912.         END
  913.         END IF
  914.         X1 = 0
  915.  
  916.  
  917.                                      13
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.         Y1 = 0
  925.         X2 = 110
  926.         Y2 = 110
  927.         FOR I = 0 TO 50
  928.         XA = (RND * X2 - X1) + X1
  929.         YA = (RND * Y2 - Y1) + Y1
  930.         XB = (RND * X2 - X1) + X1
  931.         YB = (RND * Y2 - Y1) + Y1
  932.         C = RND * 16
  933.         DRWLINE 1, C, XA, YA, XB, YB
  934.         NEXT I
  935.         DRWBOX 1, 15, X1, Y1, X2, Y2
  936.         BLKGET X1, Y1, X2, Y2, SRC(0)
  937.         X1 = GETMAXX \ 2
  938.         Y1 = GETMAXY \ 2
  939.         FOR I = 0 TO 359 STEP 6
  940.         IF BLKROTATESIZE(I, SRC(0)) <> 0 THEN
  941.          DUMMY = BLKROTATE(I, 0, SRC(0), DST(0))
  942.          BLKPUT 2, X1 - DST(0) \ 2, Y1 - DST(1) \ 2, DST(0)
  943.          SDELAY 3
  944.          BLKPUT 2, X1 - DST(0) \ 2, Y1 - DST(1) \ 2, DST(0)
  945.         END IF
  946.         NEXT I
  947.         VIDEOMODESET VMODE
  948.         END
  949.  
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.                                      14
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.       BLKROTATESIZE
  988.  
  989.         PROTOTYPE
  990.  
  991.         FUNCTION BLKROTATESIZE& (Ang%, SourceGfxBlk%)
  992.  
  993.         INPUT
  994.  
  995.         Ang - integer degree to rotate source bitmap
  996.         SourceGfxBlk - integer source array
  997.  
  998.         OUTPUT
  999.  
  1000.         BLKROTATESIZE returns the number of bytes needed for the
  1001.         destination array if successful, 0 if unsuccessful.
  1002.  
  1003.         USAGE
  1004.  
  1005.         BLKROTATESIZE takes the bitmap in SourceGfxBlk calculates the
  1006.         required size of the output buffer needed when BLKROTATE is
  1007.         called.  It also insures that the internal library buffers are
  1008.         not overflowed.  The function will fail if it calculates that
  1009.         the internal buffers would be overflowed or if the destination
  1010.         array would be larger than 65536 bytes.  BLKROTATESIZE should
  1011.         be called prior to BLKROTATE to ensure that buffer integrity
  1012.         is maintained.
  1013.  
  1014.         SEE ALSO
  1015.  
  1016.         BLKGET, BLKPUT, BLKRESIZE, BLKROTATE
  1017.  
  1018.         EXAMPLE
  1019.  
  1020.         See BLKROTATE
  1021.  
  1022.  
  1023.  
  1024.  
  1025.  
  1026.  
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.                                      15
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.       BYTECOPY
  1051.  
  1052.         PROTOTYPE
  1053.  
  1054.         SUB BYTECOPY (SrcArray%, DestArray%, NumOfBytes&)
  1055.  
  1056.         INPUT
  1057.  
  1058.         SrcArray - integer array to be copied
  1059.         NumBytes - number of bytes to copy from SrcArray to DestArray
  1060.  
  1061.         OUTPUT
  1062.  
  1063.         no value returned
  1064.         DestArray - integer destination array holding copied data
  1065.  
  1066.         USAGE
  1067.  
  1068.         BYTECOPY copies the specified number of bytes from SrcArray to
  1069.         DestArray.  It is much faster than using a FOR/NEXT loop.  The
  1070.         arrays must be integer arrays.  NumBytes is equal to twice the
  1071.         number of elements to be copied.  For example, if SrcArray
  1072.         contains 10 integers to be copied, NumBytes is 2 * 10, or 20
  1073.         bytes.  The declaration for BYTECOPY can be changed to allow
  1074.         real numbers in which case NumBytes is equal to 4 times the
  1075.         number of elements to be copied.  Note, however, that BYTECOPY
  1076.         will not work with strings.
  1077.  
  1078.         Arrays should be passed by giving the element within the array
  1079.         from where the action should take place.  This allows the
  1080.         programmer to store more than one item within the same array
  1081.         or act on only a portion of the array.
  1082.  
  1083.         SEE ALSO
  1084.  
  1085.         PALCOPY
  1086.  
  1087.         EXAMPLE
  1088.  
  1089.         REM COPIES AN ARRAY
  1090.         REM $INCLUDE: 'SVGABC.BI'
  1091.         DEFINT A-Z
  1092.         DIM ARRAY1(1 TO 10) AS INTEGER
  1093.         DIM ARRAY2(1 TO 10) AS INTEGER
  1094.  
  1095.         CLS
  1096.         FOR I=1 TO 10
  1097.         ARRAY1(I) = I
  1098.         ARRAY2(I) = 11 - I
  1099.         NEXT I
  1100.         PRINT "Before copying:"
  1101.         FOR I=1 TO 10
  1102.         PRINT ARRAY1(I);
  1103.         NEXT I
  1104.  
  1105.  
  1106.                                      16
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.         PRINT
  1114.         FOR I=1 TO 10
  1115.         PRINT ARRAY2(I);
  1116.         NEXT I
  1117.         PRINT
  1118.         BYTECOPY ARRAY1(1), ARRAY2(1), 20
  1119.         PRINT "After copying:"
  1120.         FOR I=1 TO 10
  1121.         PRINT ARRAY1(I);
  1122.         NEXT I
  1123.         PRINT
  1124.         FOR I=1 TO 10
  1125.         PRINT ARRAY2(I);
  1126.         NEXT I
  1127.         PRINT
  1128.         END
  1129.  
  1130.  
  1131.  
  1132.  
  1133.  
  1134.  
  1135.  
  1136.  
  1137.  
  1138.  
  1139.  
  1140.  
  1141.  
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.                                      17
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.       D2ROTATE
  1177.  
  1178.         PROTOTYPE
  1179.  
  1180.         SUB D2ROTATE (NumPoints%, XOrigin%, YOrigin%, Angle%,
  1181.         InArray%, OutArray%)
  1182.  
  1183.         INPUT
  1184.  
  1185.         NumPoints - number of points to be rotated
  1186.         Xorigin, Yorigin - center of rotation
  1187.         Angle - angle of rotation about center
  1188.         InArray - P2DType array containing points to rotate
  1189.  
  1190.         OUTPUT
  1191.  
  1192.         no value returned
  1193.         OutArray - P2DType array holding rotated values
  1194.  
  1195.         USAGE
  1196.  
  1197.         D2ROTATE takes the two dimensional points given in InArray and
  1198.         rotates them by the specified angle about Xorigin, Yorigin.
  1199.         The results are returned in OutArray which can be the same as
  1200.         InArray.  A positive angle causes a clockwise rotation on the
  1201.         screen, from the positive X axis to the positive Y axis.
  1202.  
  1203.         Arrays should be passed by giving the element within the array
  1204.         from where the action should take place.  This allows the
  1205.         programmer to store more than one item within the same array
  1206.         or act on only a portion of the array.
  1207.  
  1208.         SEE ALSO
  1209.  
  1210.         D2SCALE, D2TRANSLATE
  1211.  
  1212.         EXAMPLE
  1213.  
  1214.         REM ROTATE A TRIANGLE ABOUT ONE CORNER
  1215.         REM $INCLUDE: 'SVGABC.BI'
  1216.         DEFINT A-Z
  1217.         DIM TRIO(1 TO 3) AS P2DType
  1218.         DIM TRI(1 TO 3) AS P2DType
  1219.         DIM TRI2(1 TO 3) AS P2DType
  1220.  
  1221.         TRIO(1).X = 0
  1222.         TRIO(1).Y = 0
  1223.         TRIO(2).X = -80
  1224.         TRIO(2).Y = 60
  1225.         TRIO(3).X = 80
  1226.         TRIO(3).Y = 60
  1227.         VMODE = VIDEOMODEGET
  1228.         IF WHICHVGA = 0 THEN STOP
  1229.         DUMMY=RES640
  1230.  
  1231.  
  1232.                                      18
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.         GOSUB DRWTRI
  1240.         FOR I = 0 TO 360 STEP 2
  1241.         D2ROTATE 3, 0, 0, I, TRIO(1).X, TRI(1).X
  1242.         GOSUB DRWTRI
  1243.         SDELAY 2
  1244.         GOSUB ERTRI
  1245.         NEXT I
  1246.         GOSUB DRWTRI
  1247.         WHILE INKEY$ = ""
  1248.         WEND
  1249.         VIDEOMODESET VMODE
  1250.         END
  1251.  
  1252.         DRWTRI:
  1253.         D2TRANSLATE 3, 320, 240, TRI(1).X, TRI2(1).X
  1254.         DRWLINE 1, 10, TRI2(1).X, TRI2(1).Y, TRI2(2).X, TRI2(2).Y
  1255.         DRWLINE 1, 10, TRI2(2).X, TRI2(2).Y, TRI2(3).X, TRI2(3).Y
  1256.         DRWLINE 1, 10, TRI2(3).X, TRI2(3).Y, TRI2(1).X, TRI2(1).Y
  1257.         RETURN
  1258.  
  1259.         ERTRI:
  1260.         D2TRANSLATE 3, 320, 240, TRI(1).X, TRI2(1).X
  1261.         DRWLINE 1, 0, TRI2(1).X, TRI2(1).Y, TRI2(2).X, TRI2(2).Y
  1262.         DRWLINE 1, 0, TRI2(2).X, TRI2(2).Y, TRI2(3).X, TRI2(3).Y
  1263.         DRWLINE 1, 0, TRI2(3).X, TRI2(3).Y, TRI2(1).X, TRI2(1).Y
  1264.         RETURN
  1265.  
  1266.  
  1267.  
  1268.  
  1269.  
  1270.  
  1271.  
  1272.  
  1273.  
  1274.  
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.                                      19
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.       D2SCALE
  1303.  
  1304.         PROTOTYPE
  1305.  
  1306.         SUB D2SCALE (NumPoints%, ScaleX%, ScaleY%, InArray%,
  1307.         OutArray%)
  1308.  
  1309.         INPUT
  1310.  
  1311.         NumPoints - number of points to scale
  1312.         ScaleX - scale factor along X axis
  1313.         ScaleY - scale factor along Y axis
  1314.         InArray - P2DType array containing points to scale
  1315.  
  1316.         OUTPUT
  1317.  
  1318.         no value returned
  1319.         OutArray - P2DType array holding scaled values
  1320.  
  1321.         USAGE
  1322.  
  1323.         D2SCALE multiplies each coordinate in the two dimensional
  1324.         array InArray by the corresponding scale factor ScaleX or
  1325.         ScaleY.  The results are stored in OutArray which can be the
  1326.         same as InArray.  A scale factor of 256 (100 hex) is
  1327.         considered 100 percent and results in no change.  Therefore,
  1328.         128 (80 hex) reduces values by one half and 512 (200 hex)
  1329.         doubles values.
  1330.  
  1331.         Arrays should be passed by giving the element within the array
  1332.         from where the action should take place.  This allows the
  1333.         programmer to store more than one item within the same array
  1334.         or act on only a portion of the array.
  1335.  
  1336.         SEE ALSO
  1337.  
  1338.         D2ROTATE, D2TRANSLATE
  1339.  
  1340.         EXAMPLE
  1341.  
  1342.         REM SCALE A TRIANGLE
  1343.         REM $INCLUDE: 'SVGABC.BI'
  1344.         DEFINT A-Z
  1345.         DIM TRIO(1 TO 3) AS P2DType
  1346.         DIM TRI(1 TO 3) AS P2DType
  1347.         DIM TRI2(1 TO 3) AS P2DType
  1348.  
  1349.         TRIO(1).X = 0
  1350.         TRIO(1).Y = 0
  1351.         TRIO(2).X = -80
  1352.         TRIO(2).Y = 60
  1353.         TRIO(3).X = 80
  1354.         TRIO(3).Y = 60
  1355.         VMODE = VIDEOMODEGET
  1356.  
  1357.  
  1358.                                      20
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.         IF WHICHVGA = 0 THEN STOP
  1366.         DUMMY=RES640
  1367.         GOSUB DRWTRI
  1368.         FOR I = 256 TO 512 STEP 4
  1369.         D2SCALE 3, I, I, TRIO(1).X, TRI(1).X
  1370.         GOSUB DRWTRI
  1371.         SDELAY 2
  1372.         GOSUB ERTRI
  1373.         NEXT I
  1374.         FOR I = 512 TO 128 STEP -4
  1375.         D2SCALE 3, I, I, TRIO(1).X, TRI(1).X
  1376.         GOSUB DRWTRI
  1377.         SDELAY 2
  1378.         GOSUB ERTRI
  1379.         NEXT I
  1380.  
  1381.         FOR I = 128 TO 256 STEP 4
  1382.         D2SCALE 3, I, I, TRIO(1).X, TRI(1).X
  1383.         GOSUB DRWTRI
  1384.         SDELAY 2
  1385.         GOSUB ERTRI
  1386.         NEXT I
  1387.         GOSUB DRWTRI
  1388.         WHILE INKEY$ = ""
  1389.         WEND
  1390.         VIDEOMODESET VMODE
  1391.         END
  1392.  
  1393.         DRWTRI:
  1394.         D2TRANSLATE 3, 320, 240, TRI(1).X, TRI2(1).X
  1395.         DRWLINE 1, 10, TRI2(1).X, TRI2(1).Y, TRI2(2).X, TRI2(2).Y
  1396.         DRWLINE 1, 10, TRI2(2).X, TRI2(2).Y, TRI2(3).X, TRI2(3).Y
  1397.         DRWLINE 1, 10, TRI2(3).X, TRI2(3).Y, TRI2(1).X, TRI2(1).Y
  1398.         RETURN
  1399.  
  1400.         ERTRI:
  1401.         D2TRANSLATE 3, 320, 240, TRI(1).X, TRI2(1).X
  1402.         DRWLINE 1, 0, TRI2(1).X, TRI2(1).Y, TRI2(2).X, TRI2(2).Y
  1403.         DRWLINE 1, 0, TRI2(2).X, TRI2(2).Y, TRI2(3).X, TRI2(3).Y
  1404.         DRWLINE 1, 0, TRI2(3).X, TRI2(3).Y, TRI2(1).X, TRI2(1).Y
  1405.         RETURN
  1406.  
  1407.  
  1408.  
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.                                      21
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.       D2TRANSLATE
  1429.  
  1430.         PROTOTYPE
  1431.  
  1432.         SUB D2TRANSLATE (NumPoints%, TransX%, TransY%, InArray%,
  1433.         OutArray%)
  1434.  
  1435.         INPUT
  1436.  
  1437.         NumPoints - number of points to be translated
  1438.         TransX - distance to translate along X axis
  1439.         TransY - distance to translate along Y axis
  1440.         InArray - P2DType array containing points to translate
  1441.  
  1442.         OUTPUT
  1443.  
  1444.         no value returned
  1445.         OutArray - P2DType array holding translated values
  1446.  
  1447.         USAGE
  1448.  
  1449.         D2TRANSLATE takes the two dimensional points given in InArray
  1450.         and translates them by the specified number of pixels along
  1451.         each axis.  The results are returned in OutArray which can be
  1452.         the same as InArray.
  1453.  
  1454.         Arrays should be passed by giving the element within the array
  1455.         from where the action should take place.  This allows the
  1456.         programmer to store more than one item within the same array
  1457.         or act on only a portion of the array.
  1458.  
  1459.         SEE ALSO
  1460.  
  1461.         D2ROTATE, D2SCALE
  1462.  
  1463.         EXAMPLE
  1464.  
  1465.         REM TRANSLATE A TRIANGLE
  1466.         REM $INCLUDE: 'SVGABC.BI'
  1467.         DEFINT A-Z
  1468.         DIM TRIO(1 TO 3) AS P2DType
  1469.         DIM TRI(1 TO 3) AS P2DType
  1470.         DIM TRI2(1 TO 3) AS P2DType
  1471.  
  1472.         TRIO(1).X = 0
  1473.         TRIO(1).Y = 0
  1474.         TRIO(2).X = -80
  1475.         TRIO(2).Y = 60
  1476.         TRIO(3).X = 80
  1477.         TRIO(3).Y = 60
  1478.         VMODE = VIDEOMODEGET
  1479.         IF WHICHVGA = 0 THEN STOP
  1480.         DUMMY=RES640
  1481.         GOSUB DRWTRI
  1482.  
  1483.  
  1484.                                      22
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.         FOR I = 0 TO 100 STEP 4
  1492.         D2TRANSLATE 3, I, I, TRIO(1).X, TRI(1).X
  1493.         GOSUB DRWTRI
  1494.         SDELAY 2
  1495.         GOSUB ERTRI
  1496.         NEXT I
  1497.         FOR I = 100 TO 0 STEP -4
  1498.         D2TRANSLATE 3, I, I, TRIO(1).X, TRI(1).X
  1499.         GOSUB DRWTRI
  1500.         SDELAY 2
  1501.         GOSUB ERTRI
  1502.         NEXT I
  1503.         GOSUB DRWTRI
  1504.         WHILE INKEY$ = ""
  1505.         WEND
  1506.         VIDEOMODESET VMODE
  1507.         END
  1508.  
  1509.         DRWTRI:
  1510.         D2TRANSLATE 3, 320, 240, TRI(1).X, TRI2(1).X
  1511.         DRWLINE 1, 10, TRI2(1).X, TRI2(1).Y, TRI2(2).X, TRI2(2).Y
  1512.         DRWLINE 1, 10, TRI2(2).X, TRI2(2).Y, TRI2(3).X, TRI2(3).Y
  1513.         DRWLINE 1, 10, TRI2(3).X, TRI2(3).Y, TRI2(1).X, TRI2(1).Y
  1514.         RETURN
  1515.  
  1516.         ERTRI:
  1517.         D2TRANSLATE 3, 320, 240, TRI(1).X, TRI2(1).X
  1518.         DRWLINE 1, 0, TRI2(1).X, TRI2(1).Y, TRI2(2).X, TRI2(2).Y
  1519.         DRWLINE 1, 0, TRI2(2).X, TRI2(2).Y, TRI2(3).X, TRI2(3).Y
  1520.         DRWLINE 1, 0, TRI2(3).X, TRI2(3).Y, TRI2(1).X, TRI2(1).Y
  1521.         RETURN
  1522.  
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.                                      23
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.       D3PROJECT
  1555.  
  1556.         PROTOTYPE
  1557.  
  1558.         FUNCTION D3PROJECT% (NumPoints%, ProjParams%, InArray%,
  1559.         OutArray%)
  1560.  
  1561.         INPUT
  1562.  
  1563.         NumPoints - number of points to be projected
  1564.         ProjParams - PROJType structure containing parameters used in
  1565.         projection
  1566.            EyeX, EyeY, EyeZ - 3D location of viewer
  1567.            ScrD - distance from viewer to projection screen
  1568.            Theta - angle from positive 3D X axis to viewing direction
  1569.            Phi - angle from positive 3D Z axis to viewing direction
  1570.         InArray - P3DType array containing points to project
  1571.  
  1572.         OUTPUT
  1573.  
  1574.         D3PROJECT returns 1 if successful, 0 if any one point failed.
  1575.         OutArray - P2DType array holding projected values
  1576.  
  1577.         USAGE
  1578.                 +Z axis
  1579.                    |                   /\
  1580.                    |                  /  \
  1581.                    |            !     \ * \
  1582.                    |            !......X: /
  1583.                    |            ! Phi / \/
  1584.                    |            !    /  :
  1585.                    |            !   /   :
  1586.                    |            !  /    :
  1587.                    |       EyeX ! /ScrD :
  1588.                    |       EyeY !/      :
  1589.                    |       EyeZ *- - - -:- - - - -
  1590.                    |           / `      :
  1591.                    |          /   `     :
  1592.                    |         /      `   :
  1593.                    |        /      ---` :
  1594.                    |       /___----
  1595.                    |      /     Theta
  1596.                    |
  1597.                    |_____________________________+Y axis
  1598.                    /
  1599.                   /
  1600.                  /
  1601.                 /
  1602.                    /
  1603.                   /
  1604.                  /
  1605.              +X axis
  1606.  
  1607.  
  1608.  
  1609.  
  1610.                                      24
  1611.  
  1612.  
  1613.  
  1614.  
  1615.  
  1616.  
  1617.         D3PROJECT projects a specified number, NumPoints, of three
  1618.         dimensional points starting at InArray into two dimensions
  1619.         according to the parameters in ProjParams.  The two
  1620.         dimensional points are stored in OutArray.  The location of
  1621.         the viewer in this three dimensional space is given by EyeX,
  1622.         EyeY, EyeZ in the ProjParams structure.  The direction the
  1623.         viewer is facing is specified with ScrD, Theta, Phi in the
  1624.         ProjParams structure using spherical coordinates.  A virtual
  1625.         set of axes parallel to the true axes are placed at the
  1626.         viewer's location.  ScrD is the distance from the viewer to
  1627.         the center of the projection screen, i.e. the currently
  1628.         defined viewport on the monitor's screen.  Theta is the angle
  1629.         in the virtual X-Y plane from the virtual X axis to the
  1630.         projection screen.  Positive angles rotate counter-clockwise
  1631.         in the X-Y plane.  Lastly, the angle of elevation above or
  1632.         below the virtual X-Y plane is given by Phi.  Positive angles
  1633.         direct viewing above the plane; negative below.
  1634.  
  1635.         If a point is projected to a location behind the viewer, i.e.
  1636.         on the side of the viewer opposite the projection screen,
  1637.         D3PROJECT returns a zero indicating one or more failed points.
  1638.         The returned values of the X and Y for failed points will be -
  1639.         32768 to make them easily identified.
  1640.  
  1641.         Arrays should be passed by giving the element within the array
  1642.         from where the action should take place.  This allows the
  1643.         programmer to store more than one item within the same array
  1644.         or act on only a portion of the array.
  1645.  
  1646.         SEE ALSO
  1647.  
  1648.         D3ROTATE, D3TRANSLATE, D3SCALE, FILLCONVEXPOLY, SETVIEW
  1649.  
  1650.         EXAMPLE
  1651.  
  1652.         REM DRAW A CUBE AT THE CENTER OF THE SCREEN
  1653.         REM $INCLUDE: 'SVGABC.BI'
  1654.         DEFINT A-Z
  1655.         DIM CUBE(1 TO 8) AS P3DType
  1656.         DIM PLOT(1 TO 8) AS P2DType
  1657.         DIM PROJPARAMS AS PROJType
  1658.  
  1659.         CUBE(1).X =  100 : CUBE(1).Y = -100 : CUBE(1).Z =  100
  1660.         CUBE(2).X =  100 : CUBE(2).Y = -100 : CUBE(2).Z = -100
  1661.         CUBE(3).X =  100 : CUBE(3).Y =  100 : CUBE(3).Z = -100
  1662.         CUBE(4).X =  100 : CUBE(4).Y =  100 : CUBE(4).Z =  100
  1663.         CUBE(5).X = -100 : CUBE(5).Y = -100 : CUBE(5).Z =  100
  1664.         CUBE(6).X = -100 : CUBE(6).Y = -100 : CUBE(6).Z = -100
  1665.         CUBE(7).X = -100 : CUBE(7).Y =  100 : CUBE(7).Z = -100
  1666.         CUBE(8).X = -100 : CUBE(8).Y =  100 : CUBE(8).Z =  100
  1667.         VMODE = VIDEOMODEGET
  1668.         IF WHICHVGA = 0 THEN STOP
  1669.         DUMMY=RES640
  1670.         PROJPARAMS.EYEX = -1040
  1671.  
  1672.  
  1673.                                      25
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679.  
  1680.         PROJPARAMS.EYEY = -600
  1681.         PROJPARAMS.EYEZ = -1200
  1682.         PROJPARAMS.SCRD = 1700
  1683.         PROJPARAMS.THETA = 30
  1684.         PROJPARAMS.PHI = 45
  1685.         DUMMY = D3PROJECT(8,PROJPARAMS.EYEX,CUBE(1).X,PLOT(1).X)
  1686.         GOSUB DRWCUBE
  1687.         WHILE INKEY$ = ""
  1688.         WEND
  1689.         VIDEOMODESET VMODE
  1690.         END
  1691.  
  1692.         DRWCUBE:
  1693.         FOR J=1 TO 3
  1694.         DRWLINE 1, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+1).X, PLOT(J+1).Y
  1695.         NEXT J
  1696.         DRWLINE 1, 10, PLOT(4).X, PLOT(4).Y, PLOT(1).X, PLOT(1).Y
  1697.         FOR J=5 TO 7
  1698.         DRWLINE 1, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+1).X, PLOT(J+1).Y
  1699.         NEXT J
  1700.         DRWLINE 1, 10, PLOT(8).X, PLOT(8).Y, PLOT(5).X, PLOT(5).Y
  1701.         FOR J=1 TO 4
  1702.         DRWLINE 1, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+4).X, PLOT(J+4).Y
  1703.         NEXT J
  1704.         RETURN
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.  
  1724.  
  1725.  
  1726.  
  1727.  
  1728.  
  1729.  
  1730.  
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736.                                      26
  1737.  
  1738.  
  1739.  
  1740.  
  1741.  
  1742.  
  1743.       D3ROTATE
  1744.  
  1745.         PROTOTYPE
  1746.  
  1747.         SUB D3ROTATE (NumPoints%, X%, Y%, Z%, AngleZ%, AngleY%,
  1748.         AngleX%, InArray%, OutArray%)
  1749.  
  1750.         INPUT
  1751.  
  1752.         NumPoints - number of points to be rotated
  1753.         X, Y, Z - center of rotation
  1754.         AngleZ - angle of rotation about the Z axis
  1755.         AngleY - angle of rotation about the Y axis
  1756.         AngleX - angle of rotation about the X axis
  1757.         InArray - P3DType array containing points to rotate
  1758.  
  1759.         OUTPUT
  1760.  
  1761.         no value returned
  1762.         OutArray - P3DType array holding rotated values
  1763.  
  1764.         USAGE
  1765.  
  1766.         D3ROTATE takes the three dimensional points given in InArray
  1767.         and rotates them by the specified angles about Xorigin,
  1768.         Yorigin, Zorigin.  The results are returned in OutArray which
  1769.         can be the same as InArray.  A virtual set of axes are placed
  1770.         at the origin of rotation and rotation takes place about these
  1771.         axes.  A positive angle causes a counter-clockwise rotation
  1772.         from the positive X axis to the positive Y axis.
  1773.  
  1774.         Arrays should be passed by giving the element within the array
  1775.         from where the action should take place.  This allows the
  1776.         programmer to store more than one item within the same array
  1777.         or act on only a portion of the array.
  1778.  
  1779.         SEE ALSO
  1780.  
  1781.         D3PROJECT, D3SCALE, D3TRANSLATE
  1782.  
  1783.         EXAMPLE
  1784.  
  1785.         REM ROTATE A CUBE AT THE CENTER OF THE SCREEN
  1786.         REM $INCLUDE: 'SVGABC.BI'
  1787.         DEFINT A-Z
  1788.         DIM CUBE(1 TO 8) AS P3DType
  1789.         DIM RCUBE(1 TO 8) AS P3DType
  1790.         DIM PLOT(1 TO 8) AS P2DType
  1791.         DIM PROJPARAMS AS PROJType
  1792.  
  1793.         CUBE(1).X =  100 : CUBE(1).Y = -100 : CUBE(1).Z =  100
  1794.         CUBE(2).X =  100 : CUBE(2).Y = -100 : CUBE(2).Z = -100
  1795.         CUBE(3).X =  100 : CUBE(3).Y =  100 : CUBE(3).Z = -100
  1796.         CUBE(4).X =  100 : CUBE(4).Y =  100 : CUBE(4).Z =  100
  1797.  
  1798.  
  1799.                                      27
  1800.  
  1801.  
  1802.  
  1803.  
  1804.  
  1805.  
  1806.         CUBE(5).X = -100 : CUBE(5).Y = -100 : CUBE(5).Z =  100
  1807.         CUBE(6).X = -100 : CUBE(6).Y = -100 : CUBE(6).Z = -100
  1808.         CUBE(7).X = -100 : CUBE(7).Y =  100 : CUBE(7).Z = -100
  1809.         CUBE(8).X = -100 : CUBE(8).Y =  100 : CUBE(8).Z =  100
  1810.         VMODE = VIDEOMODEGET
  1811.         IF WHICHVGA = 0 THEN STOP
  1812.         DUMMY=RES640
  1813.         PROJPARAMS.EYEX = -1040
  1814.         PROJPARAMS.EYEY = -600
  1815.         PROJPARAMS.EYEZ = -1200
  1816.         PROJPARAMS.SCRD = 1700
  1817.         PROJPARAMS.THETA = 30
  1818.         PROJPARAMS.PHI = 45
  1819.         FOR I = 0 TO 360 STEP 5
  1820.         D3ROTATE 8, 0, 0, 0, I, I, I, CUBE(1).X, RCUBE(1).X
  1821.         DUMMY = D3PROJECT(8,PROJPARAMS.EYEX,RCUBE(1).X,PLOT(1).X)
  1822.         GOSUB DRWCUBE
  1823.         SDELAY 2
  1824.         GOSUB DRWCUBE
  1825.         NEXT I
  1826.         WHILE INKEY$ = ""
  1827.         WEND
  1828.         VIDEOMODESET VMODE
  1829.         END
  1830.  
  1831.         DRWCUBE:
  1832.         FOR J=1 TO 3
  1833.         DRWLINE 2, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+1).X, PLOT(J+1).Y
  1834.         NEXT J
  1835.         DRWLINE 2, 10, PLOT(4).X, PLOT(4).Y, PLOT(1).X, PLOT(1).Y
  1836.         FOR J=5 TO 7
  1837.         DRWLINE 2, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+1).X, PLOT(J+1).Y
  1838.         NEXT J
  1839.         DRWLINE 2, 10, PLOT(8).X, PLOT(8).Y, PLOT(5).X, PLOT(5).Y
  1840.         FOR J=1 TO 4
  1841.         DRWLINE 2, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+4).X, PLOT(J+4).Y
  1842.         NEXT J
  1843.         RETURN
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855.  
  1856.  
  1857.  
  1858.  
  1859.  
  1860.  
  1861.  
  1862.                                      28
  1863.  
  1864.  
  1865.  
  1866.  
  1867.  
  1868.  
  1869.       D3SCALE
  1870.  
  1871.         PROTOTYPE
  1872.  
  1873.         SUB D3SCALE (NumPoints%, ScaleX%, ScaleY%, ScaleZ%, InArray%,
  1874.         OutArray%)
  1875.  
  1876.         INPUT
  1877.  
  1878.         NumPoints - number of points to scale
  1879.         ScaleX - scale factor along X axis
  1880.         ScaleY - scale factor along Y axis
  1881.         ScaleZ - scale factor along Z axis
  1882.         InArray - P3DType array containing points to scale
  1883.  
  1884.         OUTPUT
  1885.  
  1886.         no value returned
  1887.         OutArray - P3DType array holding scaled values
  1888.  
  1889.         USAGE
  1890.  
  1891.         D3SCALE multiplies each coordinate in the three dimensional
  1892.         array InArray by the corresponding scale factor ScaleX, ScaleY
  1893.         or ScaleZ.  The results are stored in OutArray which can be
  1894.         the same as InArray.  A scale factor of 256 (100 hex) is
  1895.         considered 100 percent and results in no change.  Therefore,
  1896.         128 (80 hex) reduces values by one half and 512 (200 hex)
  1897.         doubles values.
  1898.  
  1899.         Arrays should be passed by giving the element within the array
  1900.         from where the action should take place.  This allows the
  1901.         programmer to store more than one item within the same array
  1902.         or act on only a portion of the array.
  1903.  
  1904.         SEE ALSO
  1905.  
  1906.         D3PROJECT, D3ROTATE, D3TRANSLATE
  1907.  
  1908.         EXAMPLE
  1909.  
  1910.         REM SCALE A CUBE AT THE CENTER OF THE SCREEN
  1911.         REM $INCLUDE: 'SVGABC.BI'
  1912.         DEFINT A-Z
  1913.         DIM CUBE(1 TO 8) AS P3DType
  1914.         DIM SCUBE(1 TO 8) AS P3DType
  1915.         DIM PLOT(1 TO 8) AS P2DType
  1916.         DIM PROJPARAMS AS PROJType
  1917.  
  1918.         CUBE(1).X =  100 : CUBE(1).Y = -100 : CUBE(1).Z =  100
  1919.         CUBE(2).X =  100 : CUBE(2).Y = -100 : CUBE(2).Z = -100
  1920.         CUBE(3).X =  100 : CUBE(3).Y =  100 : CUBE(3).Z = -100
  1921.         CUBE(4).X =  100 : CUBE(4).Y =  100 : CUBE(4).Z =  100
  1922.         CUBE(5).X = -100 : CUBE(5).Y = -100 : CUBE(5).Z =  100
  1923.  
  1924.  
  1925.                                      29
  1926.  
  1927.  
  1928.  
  1929.  
  1930.  
  1931.  
  1932.         CUBE(6).X = -100 : CUBE(6).Y = -100 : CUBE(6).Z = -100
  1933.         CUBE(7).X = -100 : CUBE(7).Y =  100 : CUBE(7).Z = -100
  1934.         CUBE(8).X = -100 : CUBE(8).Y =  100 : CUBE(8).Z =  100
  1935.         VMODE = VIDEOMODEGET
  1936.         IF WHICHVGA = 0 THEN STOP
  1937.         DUMMY=RES640
  1938.         PROJPARAMS.EYEX = -1040
  1939.         PROJPARAMS.EYEY = -600
  1940.         PROJPARAMS.EYEZ = -1200
  1941.         PROJPARAMS.SCRD = 1700
  1942.         PROJPARAMS.THETA = 30
  1943.         PROJPARAMS.PHI = 45
  1944.         FOR I = 256 TO 128 STEP -4
  1945.         D3SCALE 8, I, I, I, CUBE(1).X, SCUBE(1).X
  1946.         DUMMY = D3PROJECT(8,PROJPARAMS.EYEX,SCUBE(1).X,PLOT(1).X)
  1947.         GOSUB DRWCUBE
  1948.         SDELAY 2
  1949.         GOSUB DRWCUBE
  1950.         NEXT I
  1951.         FOR I = 132 TO 256 STEP 4
  1952.         D3SCALE 8, I, I, I, CUBE(1).X, SCUBE(1).X
  1953.         DUMMY = D3PROJECT(8,PROJPARAMS.EYEX,SCUBE(1).X,PLOT(1).X)
  1954.         GOSUB DRWCUBE
  1955.         SDELAY 2
  1956.         GOSUB DRWCUBE
  1957.         NEXT I
  1958.         WHILE INKEY$ = ""
  1959.         WEND
  1960.         VIDEOMODESET VMODE
  1961.         END
  1962.  
  1963.         DRWCUBE:
  1964.         FOR J=1 TO 3
  1965.         DRWLINE 2, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+1).X, PLOT(J+1).Y
  1966.         NEXT J
  1967.         DRWLINE 2, 10, PLOT(4).X, PLOT(4).Y, PLOT(1).X, PLOT(1).Y
  1968.         FOR J=5 TO 7
  1969.         DRWLINE 2, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+1).X, PLOT(J+1).Y
  1970.         NEXT J
  1971.         DRWLINE 2, 10, PLOT(8).X, PLOT(8).Y, PLOT(5).X, PLOT(5).Y
  1972.         FOR J=1 TO 4
  1973.         DRWLINE 2, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+4).X, PLOT(J+4).Y
  1974.         NEXT J
  1975.         RETURN
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.  
  1985.  
  1986.  
  1987.  
  1988.                                      30
  1989.  
  1990.  
  1991.  
  1992.  
  1993.  
  1994.  
  1995.       D3TRANSLATE
  1996.  
  1997.         PROTOTYPE
  1998.  
  1999.         SUB D3TRANSLATE (NumPoints%, TransX%, TransY%, TransZ%,
  2000.         InArray%, OutArray%)
  2001.  
  2002.         INPUT
  2003.  
  2004.         NumPoints - number of points to translate
  2005.         TransX - distance to translate along X axis
  2006.         TransY - distance to translate along Y axis
  2007.         TransZ - distance to translate along Z axis
  2008.         InArray - P3DType array containing points to translate
  2009.  
  2010.         OUTPUT
  2011.  
  2012.         no value returned
  2013.         OutArray - P3DType array holding translated points
  2014.  
  2015.         USAGE
  2016.  
  2017.         D3TRANSLATE takes the three dimensional points given in
  2018.         InArray and translates them by the specified number of pixels
  2019.         along each axis.  The results are returned in OutArray which
  2020.         can be the same as InArray.
  2021.  
  2022.         Arrays should be passed by giving the element within the array
  2023.         from where the action should take place.  This allows the
  2024.         programmer to store more than one item within the same array
  2025.         or act on only a portion of the array.
  2026.  
  2027.         SEE ALSO
  2028.  
  2029.         D3PROJECT, D3ROTATE, D3SCALE
  2030.  
  2031.         EXAMPLE
  2032.  
  2033.         REM TRANSLATE A CUBE NEAR THE CENTER OF THE SCREEN
  2034.         REM $INCLUDE: 'SVGABC.BI'
  2035.         DEFINT A-Z
  2036.         DIM CUBE(1 TO 8) AS P3DType
  2037.         DIM TCUBE(1 TO 8) AS P3DType
  2038.         DIM PLOT(1 TO 8) AS P2DType
  2039.         DIM PROJPARAMS AS PROJType
  2040.  
  2041.         CUBE(1).X =  100 : CUBE(1).Y = -100 : CUBE(1).Z =  100
  2042.         CUBE(2).X =  100 : CUBE(2).Y = -100 : CUBE(2).Z = -100
  2043.         CUBE(3).X =  100 : CUBE(3).Y =  100 : CUBE(3).Z = -100
  2044.         CUBE(4).X =  100 : CUBE(4).Y =  100 : CUBE(4).Z =  100
  2045.         CUBE(5).X = -100 : CUBE(5).Y = -100 : CUBE(5).Z =  100
  2046.         CUBE(6).X = -100 : CUBE(6).Y = -100 : CUBE(6).Z = -100
  2047.         CUBE(7).X = -100 : CUBE(7).Y =  100 : CUBE(7).Z = -100
  2048.         CUBE(8).X = -100 : CUBE(8).Y =  100 : CUBE(8).Z =  100
  2049.  
  2050.  
  2051.                                      31
  2052.  
  2053.  
  2054.  
  2055.  
  2056.  
  2057.  
  2058.         VMODE = VIDEOMODEGET
  2059.         IF WHICHVGA = 0 THEN STOP
  2060.         DUMMY=RES640
  2061.         PROJPARAMS.EYEX = -1040
  2062.         PROJPARAMS.EYEY = -600
  2063.         PROJPARAMS.EYEZ = -1200
  2064.         PROJPARAMS.SCRD = 1700
  2065.         PROJPARAMS.THETA = 30
  2066.         PROJPARAMS.PHI = 45
  2067.         FOR I = 0 TO 100 STEP 2
  2068.         D3TRANSLATE 8, I, I, I, CUBE(1).X, TCUBE(1).X
  2069.         DUMMY = D3PROJECT(8,PROJPARAMS.EYEX,TCUBE(1).X,PLOT(1).X)
  2070.         GOSUB DRWCUBE
  2071.         SDELAY 2
  2072.         GOSUB DRWCUBE
  2073.         NEXT I
  2074.         FOR I = 98 TO 0 STEP -2
  2075.         D3TRANSLATE 8, I, I, I, CUBE(1).X, TCUBE(1).X
  2076.         DUMMY = D3PROJECT(8,PROJPARAMS.EYEX,TCUBE(1).X,PLOT(1).X)
  2077.         GOSUB DRWCUBE
  2078.         SDELAY 2
  2079.         GOSUB DRWCUBE
  2080.         NEXT I
  2081.         WHILE INKEY$ = ""
  2082.         WEND
  2083.         VIDEOMODESET VMODE
  2084.         END
  2085.  
  2086.         DRWCUBE:
  2087.         FOR J=1 TO 3
  2088.         DRWLINE 2, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+1).X, PLOT(J+1).Y
  2089.         NEXT J
  2090.         DRWLINE 2, 10, PLOT(4).X, PLOT(4).Y, PLOT(1).X, PLOT(1).Y
  2091.         FOR J=5 TO 7
  2092.         DRWLINE 2, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+1).X, PLOT(J+1).Y
  2093.         NEXT J
  2094.         DRWLINE 2, 10, PLOT(8).X, PLOT(8).Y, PLOT(5).X, PLOT(5).Y
  2095.         FOR J=1 TO 4
  2096.         DRWLINE 2, 10, PLOT(J).X, PLOT(J).Y, PLOT(J+4).X, PLOT(J+4).Y
  2097.         NEXT J
  2098.         RETURN
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.                                      32
  2115.  
  2116.  
  2117.  
  2118.  
  2119.  
  2120.  
  2121.       DRWBOX
  2122.  
  2123.          ROTOTYPE
  2124.         P
  2125.  
  2126.         SUB DRWBOX (Mode%, Color%, X1%, Y1%, X2%, Y2%)
  2127.  
  2128.          NPUT
  2129.         I
  2130.                                    +X axis
  2131.         Mode - pixel write mode  SET
  2132.                     (   =1, XOR=2,           X1, Y1
  2133.           AND
  2134.           =3, 
  2135.         OR       =4)
  2136.         Color - index to color in current
  2137.         palette
  2138.         X1, Y1 - location of top left corner          +Y axis   X2, Y2
  2139.         X2, Y2 - location of bottom right
  2140.         corner
  2141.  
  2142.          UTPUT
  2143.         O
  2144.  
  2145.         no value returned
  2146.  
  2147.          SAGE
  2148.         U
  2149.  
  2150.         D      draws a rectangle
  2151.          RWBOX                   of the color specified using Mode
  2152.                      
  2153.         with opposite vertices defined by (X1, Y1) and (X2, Y2).  The
  2154.         vertices given do not need to be exactly the top left and
  2155.         bottom right.  They only have to reference opposite sides of
  2156.         the rectangle.  Any portion of the rectangle that lies outside
  2157.         of the currently defined viewport will not be drawn.
  2158.  
  2159.          LSO
  2160.         A
  2161.          EE 
  2162.         S
  2163.  
  2164.         DRWFILLBOX, DRWLINE, SETVIEW
  2165.  
  2166.          XAMPLE
  2167.         E
  2168.  
  2169.         REM DRAWS A BOX AROUND THE WHOLE SCREEN
  2170.         REM $INCLUDE: 'SVGABC.BI'
  2171.         DEFINT A-Z
  2172.  
  2173.         VMODE=VIDEOMODEGET
  2174.         IF WHICHVGA = 0 THEN STOP
  2175.         DUMMY=RES640
  2176.         DRWBOX 1, 10, 0, 0, 639, 479
  2177.         WHILE INKEY$ = ""
  2178.         WEND
  2179.         VIDEOMODESET VMODE
  2180.         END
  2181.  
  2182.  
  2183.  
  2184.  
  2185.  
  2186.  
  2187.  
  2188.  
  2189.  
  2190.                                      33
  2191.  
  2192.  
  2193.  
  2194.  
  2195.  
  2196.  
  2197.       DRWCIRCLE
  2198.  
  2199.          ROTOTYPE
  2200.         P
  2201.  
  2202.         SUB DRWCIRCLE (Mode%, Color%, Xcenter%, Ycenter%, Radius%)
  2203.  
  2204.          NPUT
  2205.         I
  2206.                                    +X axis
  2207.         Mode - pixel write mode  SET
  2208.                     (       XOR
  2209.                     =1,    =2,
  2210.           =3, AND
  2211.         OR       =4)                                            R
  2212.         Color - index to color in current
  2213.         palette                                           X, Y
  2214.         Xcenter, Ycenter - location of center         +Y axis
  2215.         of circle
  2216.         Radius - distance from center to edge of circle
  2217.  
  2218.          UTPUT
  2219.         O
  2220.  
  2221.         no value returned
  2222.  
  2223.          SAGE
  2224.         U
  2225.  
  2226.         DRWCIRCLE draws a circle of the specified color using Mode
  2227.         with the center located at (Xcenter, Ycenter) and a radius of
  2228.         Radius.  All values of Xcenter, Ycenter and Radius are valid.
  2229.         Any portion of the circle that lies outside of the currently
  2230.         defined viewport will not be drawn.
  2231.  
  2232.          LSO
  2233.         A
  2234.          EE 
  2235.         S
  2236.  
  2237.         DRWELLIPSE, DRWFILLCIRCLE, SETVIEW
  2238.  
  2239.         EXAMPLE
  2240.  
  2241.         REM DRAWS A CIRCLE AT THE CENTER OF THE SCREEN
  2242.         REM $INCLUDE: 'SVGABC.BI'
  2243.         DEFINT A-Z
  2244.  
  2245.         VMODE=VIDEOMODEGET
  2246.         IF WHICHVGA = 0 THEN STOP
  2247.         DUMMY=RES640
  2248.         DRWCIRCLE 1, 10, 320, 240, 200
  2249.         WHILE INKEY$ = ""
  2250.         WEND
  2251.         VIDEOMODESET VMODE
  2252.         END
  2253.  
  2254.  
  2255.  
  2256.  
  2257.  
  2258.  
  2259.  
  2260.  
  2261.  
  2262.  
  2263.                                      34
  2264.  
  2265.  
  2266.  
  2267.  
  2268.  
  2269.  
  2270.       DRWELLIPSE
  2271.  
  2272.          ROTOTYPE
  2273.         P
  2274.  
  2275.         SUB DRWELLIPSE (Mode%, Color%, Xcenter%, Ycenter%, RadiusX%,
  2276.         RadiusY%)
  2277.  
  2278.          NPUT
  2279.         I
  2280.                                     +X axis
  2281.         Mode - pixel write mode  SET
  2282.                     (          =2,
  2283.                         XOR
  2284.                     =1, 
  2285.           =3, AND
  2286.         OR       =4)                                           RY
  2287.         Color - index to color in current                 X, Y
  2288.         palette                                                  RX
  2289.         Xcenter, Ycenter - location of center      +Y axis
  2290.         of ellipse
  2291.         RadiusX - radius parallel to X axis
  2292.         RadiusY - radius parallel to Y axis
  2293.  
  2294.          UTPUT
  2295.         O
  2296.  
  2297.         no value returned
  2298.  
  2299.          SAGE
  2300.         U
  2301.  
  2302.          RWELLIPSE 
  2303.         D          draws an ellipse of the specified color using Mode
  2304.         with the center defined by (Xcenter, Ycenter).  The radius in
  2305.         the horizontal direction is RaduisX and the radius in the
  2306.         vertical direction is RadiusY.  All values of Xcenter,
  2307.         Ycenter, RadiusX and RadiusY are valid.  Any portion of the
  2308.         ellipse that lies outside of the currently defined viewport
  2309.         will not be drawn.
  2310.  
  2311.         S   ALSO
  2312.          EE 
  2313.  
  2314.         DRWCIRCLE, DRWFILLELLIPSE, SETVIEW
  2315.  
  2316.          XAMPLE
  2317.         E
  2318.  
  2319.         REM DRAWS AN ELLIPSE AT THE CENTER OF THE SCREEN
  2320.         REM $INCLUDE: 'SVGABC.BI'
  2321.         DEFINT A-Z
  2322.  
  2323.         VMODE=VIDEOMODEGET
  2324.         IF WHICHVGA = 0 THEN STOP
  2325.         DUMMY=RES640
  2326.         DRWELLIPSE 1, 10, 320, 240, 318, 238
  2327.         WHILE INKEY$ = ""
  2328.         WEND
  2329.         VIDEOMODESET VMODE
  2330.         END
  2331.  
  2332.  
  2333.  
  2334.  
  2335.  
  2336.  
  2337.                                      35
  2338.  
  2339.  
  2340.  
  2341.  
  2342.  
  2343.  
  2344.       DRWFILLBOX
  2345.  
  2346.          ROTOTYPE
  2347.         P
  2348.  
  2349.         SUB DRWFILLBOX (Mode%, Color%, X1%, Y1%, X2%, Y2%)
  2350.  
  2351.          NPUT
  2352.         I
  2353.                                    +X axis
  2354.         Mode - pixel write mode  SET
  2355.                     (   =1, XOR=2,           X1, Y1
  2356.           AND
  2357.           =3, 
  2358.         OR       =4)
  2359.         Color - index to color in current
  2360.         palette
  2361.         X1, Y1 - location of top left corner          +Y axis   X2, Y2
  2362.         X2, Y2 - location of bottom right
  2363.         corner
  2364.  
  2365.          UTPUT
  2366.         O
  2367.  
  2368.         no value returned
  2369.  
  2370.          SAGE
  2371.         U
  2372.  
  2373.         DRWFILLBOX draws a filled rectangle of the color specified
  2374.                         
  2375.         using Mode with opposite vertices defined by (X1, Y1) and (X2,
  2376.         Y2).  The vertices given do not need to be exactly the top
  2377.         left and bottom right.  They only have to reference opposite
  2378.         sides of the rectangle.  Any portion of the rectangle that
  2379.         lies outside of the currently defined viewport will not be
  2380.         drawn.
  2381.  
  2382.          LSO
  2383.         A
  2384.         SEE 
  2385.  
  2386.           , DRWLINE
  2387.         DRWBOX         , FILLCONVEXPOLY, SETVIEW
  2388.  
  2389.          XAMPLE
  2390.         E
  2391.  
  2392.         REM DRAWS A FILLED BOX
  2393.         REM $INCLUDE: 'SVGABC.BI'
  2394.         DEFINT A-Z
  2395.  
  2396.         VMODE = VIDEOMODEGET
  2397.         IF WHICHVGA = 0 THEN STOP
  2398.         DUMMY = RES640
  2399.         DRWFILLBOX 1, 10, 100, 100, 200, 200
  2400.         WHILE INKEY$ = ""
  2401.         WEND
  2402.         VIDEOMODESET VMODE
  2403.         END
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410.  
  2411.  
  2412.                                      36
  2413.  
  2414.  
  2415.  
  2416.  
  2417.  
  2418.  
  2419.       DRWFILLCIRCLE
  2420.  
  2421.          ROTOTYPE
  2422.         P
  2423.  
  2424.         SUB DRWFILLCIRCLE (Mode%, Color%, Xcenter%, Ycenter%, Radius%)
  2425.  
  2426.          NPUT
  2427.         I
  2428.                                    +X axis
  2429.         Mode - pixel write mode  SET
  2430.                     (       XOR
  2431.                     =1,    =2,
  2432.           =3, AND
  2433.         OR       =4)                                            R
  2434.         Color - index to color in current
  2435.         palette                                           X, Y
  2436.         Xcenter, Ycenter - location of center         +Y axis
  2437.         of circle
  2438.         Radius - distance from center to edge of circle
  2439.  
  2440.          UTPUT
  2441.         O
  2442.  
  2443.         no value returned
  2444.  
  2445.          SAGE
  2446.         U
  2447.  
  2448.         DRWFILLCIRCLE draws a filled circle of the specified color
  2449.         using Mode with the center located at (Xcenter, Ycenter) and a
  2450.         radius of Radius.  All values of Xcenter, Ycenter and Radius
  2451.         are valid.  Any portion of the circle that lies outside of the
  2452.         currently defined viewport will not be drawn.
  2453.  
  2454.         S    LSO
  2455.         A
  2456.          EE 
  2457.  
  2458.         DRWCIRCLE, SETVIEW
  2459.  
  2460.          XAMPLE
  2461.         E
  2462.  
  2463.         REM DRAWS A FILLED CIRCLE
  2464.         REM $INCLUDE: 'SVGABC.BI'
  2465.         DEFINT A-Z
  2466.  
  2467.         VMODE = VIDEOMODEGET
  2468.         IF WHICHVGA = 0 THEN STOP
  2469.         DUMMY = RES640
  2470.         DRWFILLCIRCLE 1, 10, 320, 240, 50
  2471.         WHILE INKEY$ = ""
  2472.         WEND
  2473.         VIDEOMODESET VMODE
  2474.         END
  2475.  
  2476.  
  2477.  
  2478.  
  2479.  
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.                                      37
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.       DRWFILLELLIPSE
  2493.  
  2494.          ROTOTYPE
  2495.         P
  2496.  
  2497.         SUB DRWFILLELLIPSE (Mode%, Color%, Xcenter%, Ycenter%,
  2498.         RadiusX%, RadiusY%)
  2499.  
  2500.          NPUT
  2501.         I
  2502.                                     +X axis
  2503.         Mode - pixel write mode  SET
  2504.                     (          =2,
  2505.                         XOR
  2506.                     =1, 
  2507.           =3, AND
  2508.         OR       =4)                                           RY
  2509.         Color - index to color in current                 X, Y
  2510.         palette                                                  RX
  2511.         Xcenter, Ycenter - location of center      +Y axis
  2512.         of ellipse
  2513.         RadiusX - radius parallel to X axis
  2514.         RadiusY - radius parallel to Y axis
  2515.  
  2516.          UTPUT
  2517.         O
  2518.  
  2519.         no value returned
  2520.  
  2521.          SAGE
  2522.         U
  2523.  
  2524.          RWFILLELLIPSE 
  2525.         D              draws a filled ellipse of the specified color
  2526.         using Mode with the center defined by (Xcenter, Ycenter).  The
  2527.         radius in the horizontal direction is RaduisX and the radius
  2528.         in the vertical direction is RadiusY.  All values of Xcenter,
  2529.         Ycenter, RadiusX and RadiusY are valid.  Any portion of the
  2530.         ellipse that lies outside of the currently defined viewport
  2531.         will not be drawn.
  2532.  
  2533.         ALSO
  2534.          EE 
  2535.         S
  2536.  
  2537.         DRWELLIPSE, SETVIEW
  2538.  
  2539.         EXAMPLE
  2540.  
  2541.         REM DRAWS A FILLED ELLIPSE
  2542.         REM $INCLUDE: 'SVGABC.BI'
  2543.         DEFINT A-Z
  2544.  
  2545.         VMODE = VIDEOMODEGET
  2546.         IF WHICHVGA = 0 THEN STOP
  2547.         DUMMY = RES640
  2548.         DRWFILLELLIPSE 1, 10, 320, 240, 118, 50
  2549.         WHILE INKEY$ = ""
  2550.         WEND
  2551.         VIDEOMODESET VMODE
  2552.         END
  2553.  
  2554.  
  2555.  
  2556.  
  2557.  
  2558.  
  2559.                                      38
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.       DRWLINE
  2567.  
  2568.          ROTOTYPE
  2569.         P
  2570.  
  2571.         SUB DRWLINE (Mode%, Color%, X1%, Y1%, X2%, Y2%)
  2572.  
  2573.          NPUT
  2574.         I
  2575.                                    +X axis
  2576.         Mode - pixel write mode  SET
  2577.                     (       XOR
  2578.                     =1,    =2,         X1, Y1
  2579.           AND
  2580.           =3, 
  2581.         OR       =4)
  2582.         Color - index to color in current palette
  2583.         X1, Y1 - location of one endpoint of line
  2584.         X2, Y2 - location of other endpoint of        +Y axis    X2, Y2
  2585.         line
  2586.  
  2587.          UTPUT
  2588.         O
  2589.  
  2590.         no value returned
  2591.  
  2592.          SAGE
  2593.         U
  2594.  
  2595.          RWLINE 
  2596.         D       draws a line of the specified color using Mode with
  2597.         endpoints located at (X1, Y1) and (X2, Y2).  All values of X1,
  2598.         Y1, X2 and Y2 are valid.  Any portion of the line that lies
  2599.         outside of the currently defined viewport will not be drawn.
  2600.  
  2601.         ALSO
  2602.          EE 
  2603.         S
  2604.  
  2605.         DRWBOX, SETVIEW
  2606.  
  2607.         EXAMPLE
  2608.  
  2609.         REM DRAWS A LINE FROM 0,0 TO THE CENTER OF THE SCREEN
  2610.         REM $INCLUDE: 'SVGABC.BI'
  2611.         DEFINT A-Z
  2612.  
  2613.         VMODE=VIDEOMODEGET
  2614.         IF WHICHVGA = 0 THEN STOP
  2615.         DUMMY=RES640
  2616.         DRWLINE 1, 10, 0, 0, 320, 240
  2617.         WHILE INKEY$ = ""
  2618.         WEND
  2619.         VIDEOMODESET VMODE
  2620.         END
  2621.  
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.                                      39
  2634.  
  2635.  
  2636.  
  2637.  
  2638.  
  2639.  
  2640.       DRWPOINT
  2641.  
  2642.          ROTOTYPE
  2643.         P
  2644.  
  2645.         SUB DRWPOINT (Mode%, Color%, X%, Y%)
  2646.  
  2647.          NPUT
  2648.         I
  2649.                                    +X axis
  2650.         Mode - pixel write mode  SET
  2651.                     (          =2,
  2652.                         XOR
  2653.                     =1, 
  2654.           AND
  2655.         OR=3,    =4)
  2656.         Color - index to color in current palette         X, Y
  2657.         X, Y - location of pixel to write
  2658.                               +Y axis
  2659.          UTPUT
  2660.         O
  2661.  
  2662.         no value returned
  2663.  
  2664.          SAGE
  2665.         U
  2666.  
  2667.          RWPOINT 
  2668.         D        draws a single point of the specified color using
  2669.         Mode at (X, Y).  All values of X and Y are valid.  If the
  2670.         point (X, Y) lies outside of the currently defined viewport,
  2671.         no drawing will take place.
  2672.  
  2673.         S    LSO
  2674.         A
  2675.          EE 
  2676.  
  2677.         GETPOINT, SETVIEW
  2678.  
  2679.         EXAMPLE
  2680.  
  2681.         REM DRAWS A POINT AT THE CENTER OF THE SCREEN
  2682.         REM $INCLUDE: 'SVGABC.BI'
  2683.         DEFINT A-Z
  2684.  
  2685.         VMODE=VIDEOMODEGET
  2686.         IF WHICHVGA = 0 THEN STOP
  2687.         DUMMY=RES640
  2688.         DRWPOINT 1, 10, 320, 240
  2689.         WHILE INKEY$ = ""
  2690.         WEND
  2691.         VIDEOMODESET VMODE
  2692.         END
  2693.  
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.  
  2702.  
  2703.  
  2704.  
  2705.  
  2706.  
  2707.                                      40
  2708.  
  2709.  
  2710.  
  2711.  
  2712.  
  2713.  
  2714.       DRWSTRING
  2715.  
  2716.          ROTOTYPE
  2717.         P
  2718.  
  2719.         SUB DRWSTRING (Mode%, FColor%, BColor%, Strng$, X%, Y%)
  2720.  
  2721.          NPUT
  2722.         I
  2723.                                      +   s
  2724.                                      i
  2725.                                     x
  2726.                                        a
  2727.                                     
  2728.                                       X
  2729.         Mode - pixel write mode (no action=0,              Y
  2730.                                    
  2731.                                   ,
  2732.                                  X
  2733.            =1, XOR
  2734.         SET       =2, OR=3,    =4)
  2735.                 AND
  2736.         FColor - foreground index to color in
  2737.         current palette
  2738.         BColor - background index to color in          Y
  2739.                               +   s
  2740.                                  i
  2741.                                  x
  2742.                                 a
  2743.                                  
  2744.         current palette
  2745.         Strng$ - string of ASCII characters to be drawn
  2746.         X, Y - location of upper, left corner of block
  2747.  
  2748.          UTPUT
  2749.         O
  2750.  
  2751.         no value returned
  2752.  
  2753.          SAGE
  2754.         U
  2755.  
  2756.          RWSTRING 
  2757.         D         takes the ASCII characters contained in Strng$ and
  2758.         creates a graphics block similar to the blocks used by Blkget
  2759.         and Blkput and places this block on the screen at the
  2760.         specified coordinates.  The characters are drawn with color
  2761.         FColor using the current font and the background is color
  2762.         BColor.  When mode 0, no action, is used, the graphics block
  2763.         is created in memory retrievable by GETLASTSTRING, but no text
  2764.         is actually drawn on the screen.  (Note: the system font is
  2765.         automatically installed when          
  2766.                      WHICHVGA is called.)
  2767.  
  2768.         SEE  LSO
  2769.         A
  2770.  
  2771.         FONTSET, FONTGETINFO, FONTSYSTEM, DRWSTRINGDN, DRWSTRINGLT,
  2772.         DRWSTRINGRT, GETLASTSTRING
  2773.  
  2774.          XAMPLE
  2775.         E
  2776.  
  2777.         REM DRAWS SOME NORMAL TEXT AT THE CENTER OF THE SCREEN
  2778.         REM $INCLUDE: 'SVGABC.BI'
  2779.         DEFINT A-Z
  2780.  
  2781.         VMODE=VIDEOMODEGET
  2782.         IF WHICHVGA = 0 THEN STOP
  2783.         DUMMY=RES640
  2784.         A$ = "HELLO WORLD"
  2785.         DRWSTRING 1, 10, 0, A$, 320, 240
  2786.         WHILE INKEY$ = ""
  2787.         WEND
  2788.         VIDEOMODESET VMODE
  2789.         END
  2790.  
  2791.  
  2792.  
  2793.                                      41
  2794.  
  2795.  
  2796.  
  2797.  
  2798.  
  2799.  
  2800.       DRWSTRINGDN
  2801.  
  2802.          ROTOTYPE
  2803.         P
  2804.  
  2805.         SUB DRWSTRINGDN (Mode%, FColor%, BColor%, Strng$, X%, Y%)
  2806.  
  2807.          NPUT
  2808.         I
  2809.                                      +   s
  2810.                                      i
  2811.                                     x
  2812.                                        a
  2813.                                     
  2814.                                       X
  2815.         Mode - pixel write mode (no action=0,
  2816.            =1, XOR
  2817.         SET       =2, OR=3,    =4)
  2818.                 AND
  2819.         FColor - foreground index to color in
  2820.         current palette                                          X Y
  2821.                                     
  2822.                                       ,
  2823.         BColor - background index to color in          Y
  2824.                               +   s
  2825.                                  i
  2826.                                  x
  2827.                                 a
  2828.                                  
  2829.         current palette
  2830.         Strng$ - string of ASCII characters to be drawn
  2831.         X, Y - location of lower, right corner of block
  2832.  
  2833.          UTPUT
  2834.         O
  2835.  
  2836.         no value returned
  2837.  
  2838.          SAGE
  2839.         U
  2840.  
  2841.          RWSTRINGDN 
  2842.         D           takes the ASCII characters contained in Strng$ and
  2843.         creates a graphics block similar to the blocks used by Blkget
  2844.         and Blkput.  The characters are drawn with color FColor using
  2845.         the current font and the background is color BColor.  When
  2846.         mode 0, no action, is used, the graphics block is created in
  2847.         memory retrievable by GETLASTSTRING, but no text is actually
  2848.         drawn on the screen.  (Note: the system font is automatically
  2849.         installed when  HICHVGA
  2850.                W        is called.)  The text is drawn upside
  2851.         down with X, Y specifying the lower, right corner.  This
  2852.         corner corresponds to the upper, left corner when the text is
  2853.         oriented upright.
  2854.  
  2855.         A
  2856.          EE 
  2857.         S    LSO
  2858.  
  2859.         FONTSET, FONTGETINFO, FONTSYSTEM, DRWSTRING, DRWSTRINGLT,
  2860.         DRWSTRINGRT, GETLASTSTRING
  2861.  
  2862.         EXAMPLE
  2863.  
  2864.         REM DRAWS SOME UP-SIDE-DOWN TEXT AT THE CENTER OF THE SCREEN
  2865.         REM $INCLUDE: 'SVGABC.BI'
  2866.         DEFINT A-Z
  2867.  
  2868.         VMODE=VIDEOMODEGET
  2869.         IF WHICHVGA = 0 THEN STOP
  2870.         DUMMY=RES640
  2871.         A$ = "HELLO WORLD"
  2872.         DRWSTRINGDN 1, 10, 0, A$, 320, 240
  2873.         WHILE INKEY$ = ""
  2874.         WEND
  2875.         VIDEOMODESET VMODE
  2876.  
  2877.  
  2878.                                      42
  2879.  
  2880.  
  2881.  
  2882.  
  2883.  
  2884.  
  2885.         END
  2886.  
  2887.  
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.  
  2897.  
  2898.  
  2899.  
  2900.  
  2901.  
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908.  
  2909.  
  2910.  
  2911.  
  2912.  
  2913.  
  2914.  
  2915.  
  2916.  
  2917.  
  2918.  
  2919.  
  2920.  
  2921.  
  2922.  
  2923.  
  2924.  
  2925.  
  2926.  
  2927.  
  2928.  
  2929.  
  2930.  
  2931.  
  2932.  
  2933.  
  2934.  
  2935.  
  2936.  
  2937.  
  2938.  
  2939.  
  2940.  
  2941.                                      43
  2942.  
  2943.  
  2944.  
  2945.  
  2946.  
  2947.  
  2948.       DRWSTRINGLT
  2949.  
  2950.          ROTOTYPE
  2951.         P
  2952.  
  2953.         SUB DRWSTRINGLT (Mode%, FColor%, BColor%, Strng$, X%, Y%)
  2954.  
  2955.          NPUT
  2956.         I
  2957.                                      +   s
  2958.                                      i
  2959.                                     x
  2960.                                        a
  2961.                                     
  2962.                                       X
  2963.         Mode - pixel write mode (no action=0,
  2964.            =1, XOR
  2965.         SET       =2, OR=3,    =4)
  2966.                 AND
  2967.         FColor - foreground index to color in
  2968.         current palette
  2969.         BColor - background index to color in          Y
  2970.                               +   s
  2971.                                  i
  2972.                                  x
  2973.                                 a
  2974.                                  
  2975.         current palette                                     Y
  2976.                                 
  2977.                                    ,
  2978.                                   X
  2979.         Strng$ - string of ASCII characters to be drawn
  2980.         X, Y - location of lower, left corner of block
  2981.  
  2982.          UTPUT
  2983.         O
  2984.  
  2985.         no value returned
  2986.  
  2987.          SAGE
  2988.         U
  2989.  
  2990.          RWSTRINGLT 
  2991.         D           takes the ASCII characters contained in Strng$ and
  2992.         creates a graphics block similar to the blocks used by Blkget
  2993.         and Blkput.  The characters are drawn with color FColor using
  2994.         the current font and the background is color BColor.  When
  2995.         mode 0, no action, is used, the graphics block is created in
  2996.         memory retrievable by GETLASTSTRING, but no text is actually
  2997.         drawn on the screen.  (Note: the system font is automatically
  2998.         installed when  HICHVGA
  2999.                W        is called.)  The text block is rotated
  3000.            to the left with X, Y specifying the lower, left corner.
  3001.         90
  3002.         This corner corresponds to the upper, left corner when the
  3003.         text is oriented upright.
  3004.  
  3005.  
  3006.         S   A
  3007.          EE  LSO
  3008.  
  3009.         FONTSET, FONTGETINFO, FONTSYSTEM, DRWSTRING, DRWSTRINGDN,
  3010.         DRWSTRINGRT, GETLASTSTRING
  3011.  
  3012.          XAMPLE
  3013.         E
  3014.  
  3015.         REM DRAWS SOME TEXT ROTATED BY 90 DEGREES TO THE LEFT AT THE
  3016.         REM CENTER OF THE SCREEN
  3017.         REM $INCLUDE: 'SVGABC.BI'
  3018.         DEFINT A-Z
  3019.  
  3020.         VMODE=VIDEOMODEGET
  3021.         IF WHICHVGA = 0 THEN STOP
  3022.         DUMMY=RES640
  3023.         A$ = "HELLO WORLD"
  3024.         DRWSTRINGLT 1, 10, 0, A$, 320, 240
  3025.         WHILE INKEY$ = ""
  3026.  
  3027.  
  3028.                                      44
  3029.  
  3030.  
  3031.  
  3032.  
  3033.  
  3034.  
  3035.         WEND
  3036.         VIDEOMODESET VMODE
  3037.         END
  3038.  
  3039.  
  3040.  
  3041.  
  3042.  
  3043.  
  3044.  
  3045.  
  3046.  
  3047.  
  3048.  
  3049.  
  3050.  
  3051.  
  3052.  
  3053.  
  3054.  
  3055.  
  3056.  
  3057.  
  3058.  
  3059.  
  3060.  
  3061.  
  3062.  
  3063.  
  3064.  
  3065.  
  3066.  
  3067.  
  3068.  
  3069.  
  3070.  
  3071.  
  3072.  
  3073.  
  3074.  
  3075.  
  3076.  
  3077.  
  3078.  
  3079.  
  3080.  
  3081.  
  3082.  
  3083.  
  3084.  
  3085.  
  3086.  
  3087.  
  3088.  
  3089.  
  3090.  
  3091.                                      45
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.  
  3098.       DRWSTRINGRT
  3099.  
  3100.          ROTOTYPE
  3101.         P
  3102.  
  3103.         SUB DRWSTRINGRT (Mode%, FColor%, BColor%, Strng$, X%, Y%)
  3104.  
  3105.          NPUT
  3106.         I
  3107.                                      +
  3108.                                   Y
  3109.                                  , 
  3110.                                 X        s
  3111.                                      i
  3112.                                     x
  3113.                                        a
  3114.                                     
  3115.                                       X
  3116.         Mode - pixel write mode (no action=0,
  3117.            =1, XOR
  3118.         SET       =2, OR=3,    =4)
  3119.                 AND
  3120.         FColor - foreground index to color in
  3121.         current palette                                Y
  3122.                               +   s
  3123.                                  i
  3124.                                  x
  3125.                                 a
  3126.                                  
  3127.         BColor - background index to color in
  3128.         current palette
  3129.         Strng$ - string of ASCII characters to be drawn
  3130.         X, Y - location of upper, right corner of block
  3131.  
  3132.          UTPUT
  3133.         O
  3134.  
  3135.         no value returned
  3136.  
  3137.          SAGE
  3138.         U
  3139.  
  3140.          RWSTRINGRT 
  3141.         D           takes the ASCII characters contained in Strng$ and
  3142.         creates a graphics block similar to the blocks used by Blkget
  3143.         and Blkput.  The characters are drawn with color FColor using
  3144.         the current font and the background is color BColor.  When
  3145.         mode 0, no action, is used, the graphics block is created in
  3146.         memory retrievable by GETLASTSTRING, but no text is actually
  3147.         drawn on the screen.  (Note: the system font is automatically
  3148.         installed when  HICHVGA
  3149.                W        is called.)  The text block is rotated
  3150.         90 to the right with X, Y specifying the upper, right corner.
  3151.         This corner corresponds to the upper, left corner if the text
  3152.         is oriented upright.
  3153.  
  3154.  
  3155.         A
  3156.         SEE  LSO
  3157.  
  3158.         FONTSET, FONTGETINFO, FONTSYSTEM, DRWSTRING, DRWSTRINGDN,
  3159.         DRWSTRINGLT, GETLASTSTRING
  3160.  
  3161.          XAMPLE
  3162.         E
  3163.  
  3164.         REM DRAWS SOME TEXT ROTATED BY 90 DEGREES TO THE RIGHT AT THE
  3165.         REM CENTER OF THE SCREEN
  3166.         REM $INCLUDE: 'SVGABC.BI'
  3167.         DEFINT A-Z
  3168.  
  3169.         VMODE=VIDEOMODEGET
  3170.         IF WHICHVGA = 0 THEN STOP
  3171.         DUMMY=RES640
  3172.         A$ = "HELLO WORLD"
  3173.         DRWSTRINGRT 1, 10, 0, A$, 320, 240
  3174.         WHILE INKEY$ = ""
  3175.  
  3176.  
  3177.                                      46
  3178.  
  3179.  
  3180.  
  3181.  
  3182.  
  3183.  
  3184.         WEND
  3185.         VIDEOMODESET VMODE
  3186.         END
  3187.  
  3188.  
  3189.  
  3190.  
  3191.  
  3192.  
  3193.  
  3194.  
  3195.  
  3196.  
  3197.  
  3198.  
  3199.  
  3200.  
  3201.  
  3202.  
  3203.  
  3204.  
  3205.  
  3206.  
  3207.  
  3208.  
  3209.  
  3210.  
  3211.  
  3212.  
  3213.  
  3214.  
  3215.  
  3216.  
  3217.  
  3218.  
  3219.  
  3220.  
  3221.  
  3222.  
  3223.  
  3224.  
  3225.  
  3226.  
  3227.  
  3228.  
  3229.  
  3230.  
  3231.  
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238.  
  3239.  
  3240.                                      47
  3241.  
  3242.  
  3243.  
  3244.  
  3245.  
  3246.  
  3247.       FILLAREA
  3248.  
  3249.         PROTOTYPE
  3250.  
  3251.         SUB FILLAREA (XSeed%, YSeed%, BorderColor%, FillColor%)
  3252.  
  3253.         INPUT
  3254.  
  3255.         XSeed, YSeed - seed location to start fill
  3256.         BorderColor - index to color in current palette at which
  3257.         filling stops
  3258.         FillColor - index to color in current palette to fill within
  3259.         the border
  3260.  
  3261.         OUTPUT
  3262.  
  3263.         no value returned
  3264.  
  3265.         USAGE
  3266.  
  3267.         FILLAREA fills a region with a new color specified by
  3268.         FillColor.  The region is defined by any line or curve of the
  3269.         color BorderColor or by the edge of the viewport.  All
  3270.         graphics within the region are lost and covered with the
  3271.         FillColor.  The border is not effected.
  3272.  
  3273.         SEE ALSO
  3274.  
  3275.         DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLCOLOR,
  3276.         FILLCONVEXPOLY, FILLPAGE, FILLSCREEN, FILLVIEW, SETVIEW
  3277.  
  3278.         EXAMPLE
  3279.  
  3280.         REM FILLS A BOX WITH A COLOR
  3281.         REM $INCLUDE: 'SVGABC.BI'
  3282.         DEFINT A-Z
  3283.  
  3284.         VMODE=VIDEOMODEGET
  3285.         IF WHICHVGA = 0 THEN STOP
  3286.         DUMMY=RES640
  3287.         DRWBOX 1, 10, 0, 0, 100, 100
  3288.         FILLAREA 1, 1, 10, 7
  3289.         WHILE INKEY$ = ""
  3290.         WEND
  3291.         VIDEOMODESET VMODE
  3292.         END
  3293.  
  3294.  
  3295.  
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.                                      48
  3304.  
  3305.  
  3306.  
  3307.  
  3308.  
  3309.  
  3310.       FILLCOLOR
  3311.  
  3312.         PROTOTYPE
  3313.  
  3314.         SUB FILLCOLOR (XSeed%, YSeed%, OldColor%, NewColor%)
  3315.  
  3316.         INPUT
  3317.  
  3318.         XSeed, YSeed - seed location to start fill
  3319.         OldColor - index to color in current palette to change
  3320.         NewColor - index to color in current palette to replace
  3321.         OldColor
  3322.  
  3323.         OUTPUT
  3324.  
  3325.         no value returned
  3326.  
  3327.         USAGE
  3328.  
  3329.         FILLCOLOR replaces every existence of OldColor with NewColor
  3330.         within a region.  The region is defined as any pixel of
  3331.         OldColor which has a path of pixels of OldColor or NewColor
  3332.         with sides touching back to the seed point, (XSeed, YSeed).
  3333.         Therefore, only pixels of OldColor are modified and no other
  3334.         information is changed.
  3335.  
  3336.         SEE ALSO
  3337.  
  3338.         DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  3339.         FILLCONVEXPOLY, FILLPAGE, FILLSCREEN, FILLVIEW, SETVIEW
  3340.  
  3341.         EXAMPLE
  3342.  
  3343.         REM REPLACES THE BLACK COLOR WITH A NEW COLOR
  3344.         REM $INCLUDE: 'SVGABC.BI'
  3345.         DEFINT A-Z
  3346.  
  3347.         VMODE=VIDEOMODEGET
  3348.         IF WHICHVGA = 0 THEN STOP
  3349.         DUMMY=RES640
  3350.         DRWBOX 1, 10, 0, 0, 100, 100
  3351.         DRWBOX 1, 12, 20, 20, 80, 80
  3352.         FILLCOLOR 1, 1, 0, 7
  3353.         WHILE INKEY$ = ""
  3354.         WEND
  3355.         VIDEOMODESET VMODE
  3356.         END
  3357.  
  3358.  
  3359.  
  3360.  
  3361.  
  3362.  
  3363.  
  3364.  
  3365.  
  3366.                                      49
  3367.  
  3368.  
  3369.  
  3370.  
  3371.  
  3372.  
  3373.       FILLCONVEXPOLY
  3374.  
  3375.         PROTOTYPE
  3376.  
  3377.         SUB FILLCONVEXPOLY (PolyColor%, NumPoints%, PointArray%)
  3378.  
  3379.         INPUT
  3380.  
  3381.         PolyColor - index to color in current palette
  3382.         NumPoints - number of points in PointArray
  3383.         PointArray - P2DType array holding points of polygon
  3384.  
  3385.         OUTPUT
  3386.  
  3387.         no value returned
  3388.  
  3389.         USAGE
  3390.  
  3391.         FILLCONVEXPOLY draws a solid polygon outlined by the points
  3392.         given in PointArray.  The points are expected to be
  3393.         consecutive and the resulting polygon should be convex (ie.
  3394.         the polygon should not curve in on itself like a kidney bean).
  3395.         The function also assumes that the last point in the array
  3396.         connects to the first.
  3397.  
  3398.         SEE ALSO
  3399.  
  3400.         D3PROJECT, DRWFILLBOX, FILLAREA, FILLCOLOR, FILLPAGE,
  3401.         FILLSCREEN, FILLVIEW
  3402.  
  3403.         EXAMPLE
  3404.  
  3405.         REM SHOW FILLCONVEXPOLY
  3406.         REM $INCLUDE: 'SVGABC.BI'
  3407.         DEFINT A-Z
  3408.         DIM T(0 TO 20) AS P2DType
  3409.  
  3410.         VGA = WHICHVGA
  3411.         DUMMY = RES640
  3412.  
  3413.         FOR I = 0 TO 99
  3414.            T(0).X = RND * GETMAXX
  3415.            T(0).Y = RND * GETMAXY
  3416.            T(1).X = RND * GETMAXX
  3417.            T(1).Y = RND * GETMAXY
  3418.            T(2).X = RND * GETMAXX
  3419.            T(2).Y = RND * GETMAXY
  3420.            C = RND * 15
  3421.            FILLCONVEXPOLY C, 3, T(0).X
  3422.         NEXT I
  3423.  
  3424.         WHILE INKEY$ = ""
  3425.         WEND
  3426.  
  3427.  
  3428.  
  3429.                                      50
  3430.  
  3431.  
  3432.  
  3433.  
  3434.  
  3435.  
  3436.         DUMMY = RESTEXT
  3437.         END
  3438.  
  3439.  
  3440.  
  3441.  
  3442.  
  3443.  
  3444.  
  3445.  
  3446.  
  3447.  
  3448.  
  3449.  
  3450.  
  3451.  
  3452.  
  3453.  
  3454.  
  3455.  
  3456.  
  3457.  
  3458.  
  3459.  
  3460.  
  3461.  
  3462.  
  3463.  
  3464.  
  3465.  
  3466.  
  3467.  
  3468.  
  3469.  
  3470.  
  3471.  
  3472.  
  3473.  
  3474.  
  3475.  
  3476.  
  3477.  
  3478.  
  3479.  
  3480.  
  3481.  
  3482.  
  3483.  
  3484.  
  3485.  
  3486.  
  3487.  
  3488.  
  3489.  
  3490.  
  3491.  
  3492.                                      51
  3493.  
  3494.  
  3495.  
  3496.  
  3497.  
  3498.  
  3499.       FILLPAGE
  3500.  
  3501.         PROTOTYPE
  3502.  
  3503.         SUB FILLPAGE (Color%)
  3504.  
  3505.         INPUT
  3506.  
  3507.         Color - index to color in current palette
  3508.  
  3509.         OUTPUT
  3510.  
  3511.         no value returned
  3512.  
  3513.         USAGE
  3514.  
  3515.         FILLPAGE clears the currently active page with the specified
  3516.         color.  All information on the page is lost.  (Note, a faster
  3517.         method to clear the page is to call any of the 'RES###'
  3518.         functions.  These reset the graphics screen and automatically
  3519.         clear it to color index zero as well as reset the default
  3520.         palette.)
  3521.  
  3522.         SEE ALSO
  3523.  
  3524.         DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  3525.         FILLCOLOR, FILLCONVEXPOLY, FILLSCREEN, FILLVIEW
  3526.  
  3527.         EXAMPLE
  3528.  
  3529.         REM FILLS THE CURRENT VIDEO PAGE WITH A COLOR
  3530.         REM $INCLUDE: 'SVGABC.BI'
  3531.         DEFINT A-Z
  3532.  
  3533.         VMODE=VIDEOMODEGET
  3534.         IF WHICHVGA = 0 THEN STOP
  3535.         DUMMY=RES640
  3536.         DUMMY=PAGEACTIVE(0)
  3537.         FILLPAGE 10
  3538.         WHILE INKEY$ = ""
  3539.         WEND
  3540.         VIDEOMODESET VMODE
  3541.         END
  3542.  
  3543.  
  3544.  
  3545.  
  3546.  
  3547.  
  3548.  
  3549.  
  3550.  
  3551.  
  3552.  
  3553.  
  3554.  
  3555.                                      52
  3556.  
  3557.  
  3558.  
  3559.  
  3560.  
  3561.  
  3562.       FILLSCREEN
  3563.  
  3564.         PROTOTYPE
  3565.  
  3566.         SUB FILLSCREEN (Color%)
  3567.  
  3568.         INPUT
  3569.  
  3570.         Color - index to color in current palette
  3571.  
  3572.         OUTPUT
  3573.  
  3574.         no value returned
  3575.  
  3576.         USAGE
  3577.  
  3578.         FILLSCREEN clears the entire screen with the specified color.
  3579.         All information on the screen is lost.  (Note, a faster method
  3580.         to clear the screen is to call any of the 'RES###' functions.
  3581.         These reset the graphics screen and automatically clear it to
  3582.         color index zero as well as reset the default palette.)
  3583.  
  3584.         SEE ALSO
  3585.  
  3586.         DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  3587.         FILLCOLOR, FILLCONVEXPOLY, FILLPAGE, FILLVIEW
  3588.  
  3589.         EXAMPLE
  3590.  
  3591.         REM FILLS THE SCREEN WITH A COLOR
  3592.         REM $INCLUDE: 'SVGABC.BI'
  3593.         DEFINT A-Z
  3594.  
  3595.         VMODE=VIDEOMODEGET
  3596.         IF WHICHVGA = 0 THEN STOP
  3597.         DUMMY=RES640
  3598.         FILLSCREEN 10
  3599.         WHILE INKEY$ = ""
  3600.         WEND
  3601.         VIDEOMODESET VMODE
  3602.         END
  3603.  
  3604.  
  3605.  
  3606.  
  3607.  
  3608.  
  3609.  
  3610.  
  3611.  
  3612.  
  3613.  
  3614.  
  3615.  
  3616.  
  3617.  
  3618.                                      53
  3619.  
  3620.  
  3621.  
  3622.  
  3623.  
  3624.  
  3625.       FILLVIEW
  3626.  
  3627.         PROTOTYPE
  3628.  
  3629.         SUB FILLVIEW (Color%)
  3630.  
  3631.         INPUT
  3632.  
  3633.         Color - index to color in current palette
  3634.  
  3635.         OUTPUT
  3636.  
  3637.         no value returned
  3638.  
  3639.         USAGE
  3640.  
  3641.         FILLVIEW fills the currently defined viewport with the
  3642.         specified color.  All information in the viewport is lost.
  3643.  
  3644.         SEE ALSO
  3645.  
  3646.         DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  3647.         FILLCOLOR, FILLCONVEXPOLY, FILLPAGE, FILLSCREEN, SETVIEW
  3648.  
  3649.         EXAMPLE
  3650.  
  3651.         REM FILLS THE VIEWPORT WITH A COLOR
  3652.         REM $INCLUDE: 'SVGABC.BI'
  3653.         DEFINT A-Z
  3654.  
  3655.         VMODE=VIDEOMODEGET
  3656.         IF WHICHVGA = 0 THEN STOP
  3657.         DUMMY=RES640
  3658.         SETVIEW 100, 100, 539, 379
  3659.         FILLVIEW 10
  3660.         WHILE INKEY$ = ""
  3661.         WEND
  3662.         VIDEOMODESET VMODE
  3663.         END
  3664.  
  3665.  
  3666.  
  3667.  
  3668.  
  3669.  
  3670.  
  3671.  
  3672.  
  3673.  
  3674.  
  3675.  
  3676.  
  3677.  
  3678.  
  3679.  
  3680.  
  3681.                                      54
  3682.  
  3683.  
  3684.  
  3685.  
  3686.  
  3687.  
  3688.       FONTGETINFO
  3689.  
  3690.         PROTOTYPE
  3691.  
  3692.         SUB FONTGETINFO (Width%, Height%)
  3693.  
  3694.         INPUT
  3695.  
  3696.         no input parameters
  3697.  
  3698.         OUTPUT
  3699.  
  3700.         no value returned
  3701.         Width - width in pixels of current font
  3702.         Height - height in pixels of current font
  3703.  
  3704.         USAGE
  3705.  
  3706.         FONTGETINFO returns in Width and Height the dimensions of the
  3707.         currently loaded font.
  3708.  
  3709.         SEE ALSO
  3710.  
  3711.         FONTSET, FONTSYSTEM
  3712.  
  3713.         EXAMPLE
  3714.  
  3715.         REM GET INFO ON THE SYSTEM FONT
  3716.         REM $INCLUDE: 'SVGABC.BI'
  3717.         DEFINT A-Z
  3718.  
  3719.         VMODE=VIDEOMODEGET
  3720.         IF WHICHVGA = 0 THEN STOP
  3721.         DUMMY=RES640
  3722.         FONTGETINFO WDTH, HGTH
  3723.         A$ = "SYSTEM FONT WIDTH =" + STR$(WDTH)
  3724.         B$ = "SYSTEM FONT HEIGHT =" + STR$(HGTH)
  3725.         DRWSTRING 1, 7, 0, A$, 0, 0
  3726.         DRWSTRING 1, 7, 0, B$, 0, 20
  3727.         WHILE INKEY$ = ""
  3728.         WEND
  3729.         VIDEOMODESET VMODE
  3730.         END
  3731.  
  3732.  
  3733.  
  3734.  
  3735.  
  3736.  
  3737.  
  3738.  
  3739.  
  3740.  
  3741.  
  3742.  
  3743.  
  3744.                                      55
  3745.  
  3746.  
  3747.  
  3748.  
  3749.  
  3750.  
  3751.       FONTSET
  3752.  
  3753.         PROTOTYPE
  3754.  
  3755.         SUB FONTSET (Font$)
  3756.  
  3757.         INPUT
  3758.  
  3759.         Font$ - string * 4098 containing font data
  3760.  
  3761.         OUTPUT
  3762.  
  3763.         no value returned
  3764.  
  3765.         USAGE
  3766.  
  3767.         FONTSET loads the current font with the data in Font$.  The
  3768.         string must have at least 4098 members.  The first byte of
  3769.         Font$ holds the font width (1 to 8) and the second byte holds
  3770.         the font height (1 to 16).  The remaining 4096 bytes are the
  3771.         character raster data, 16 bytes per character.
  3772.  
  3773.         SEE ALSO
  3774.  
  3775.         FONTGETINFO, FONTSYSTEM
  3776.  
  3777.         EXAMPLE
  3778.  
  3779.         See FONTSYSTEM
  3780.  
  3781.  
  3782.  
  3783.  
  3784.  
  3785.  
  3786.  
  3787.  
  3788.  
  3789.  
  3790.  
  3791.  
  3792.  
  3793.  
  3794.  
  3795.  
  3796.  
  3797.  
  3798.  
  3799.  
  3800.  
  3801.  
  3802.  
  3803.  
  3804.  
  3805.  
  3806.  
  3807.                                      56
  3808.  
  3809.  
  3810.  
  3811.  
  3812.  
  3813.  
  3814.       FONTSYSTEM
  3815.  
  3816.         PROTOTYPE
  3817.  
  3818.         SUB FONTSYSTEM ()
  3819.  
  3820.         INPUT
  3821.  
  3822.         no input parameters
  3823.  
  3824.         OUTPUT
  3825.  
  3826.         no value returned
  3827.  
  3828.         USAGE
  3829.  
  3830.         FONTSYSTEM sets the current font to the standard system font.
  3831.         This font is automatically set when WHICHVGA is called.
  3832.  
  3833.         SEE ALSO
  3834.  
  3835.         WHICHVGA, FONTGETINFO, FONTSET
  3836.  
  3837.         EXAMPLE
  3838.  
  3839.         REM LOAD A FONT FROM DISK AND ENABLE IT
  3840.         REM THEN GO BACK TO THE SYSTEM FONT
  3841.         REM $INCLUDE: 'SVGABC.BI'
  3842.         DEFINT A-Z
  3843.  
  3844.         DIM NEWFONT AS STRING * 4098
  3845.  
  3846.         VMODE = VIDEOMODEGET
  3847.         IF WHICHVGA = 0 THEN STOP
  3848.         DUMMY=RES640
  3849.         OPEN "DRAGON.FNT" FOR BINARY AS #1
  3850.         GET #1, , NEWFONT
  3851.         CLOSE #1
  3852.         FONTSET NEWFONT
  3853.         DRWSTRING 1, 7, 0, "The Dragon Font!", 0, 0
  3854.         FONTSYSTEM
  3855.         DRWSTRING 1, 7, 0, "The System Font!", 0, 20
  3856.         WHILE INKEY$ = ""
  3857.         WEND
  3858.         VIDEOMODESET VMODE
  3859.         END
  3860.  
  3861.  
  3862.  
  3863.  
  3864.  
  3865.  
  3866.  
  3867.  
  3868.  
  3869.  
  3870.                                      57
  3871.  
  3872.  
  3873.  
  3874.  
  3875.  
  3876.  
  3877.       GETARCCOS
  3878.  
  3879.         PROTOTYPE
  3880.  
  3881.         FUNCTION GETARCCOS% (Value&)
  3882.  
  3883.         INPUT
  3884.  
  3885.         Value - number between -1 and +1 scaled up by 13 bits (8192)
  3886.  
  3887.         OUTPUT
  3888.  
  3889.         GETARCCOS returns the arc cosine of Value in degrees.
  3890.  
  3891.         USAGE
  3892.  
  3893.         GETARCCOS returns the arc cosine in degrees for the given
  3894.         value.  The return will be between 0 and 180 degrees.  Value
  3895.         should be between -8192 and +8192 representing the range -1 to
  3896.         +1.  Input values outside this range are invalid and GETARCCOS
  3897.         will return -32768. Floating point values are ignored.  This
  3898.         function uses an integer lookup table stored within the
  3899.         library in order to produce the fastest possible results.  No
  3900.         floating point arithmetic is used.  The scale factor of 13
  3901.         bits (8192) was chosen because this is the number of bits at
  3902.         which every change of one degree gives a change in the value
  3903.         of the sine (or cosine) function.
  3904.  
  3905.         SEE ALSO
  3906.  
  3907.         GETARCSIN, GETARCTAN, GETCOS, GETSIN, GETTAN
  3908.  
  3909.         EXAMPLE
  3910.  
  3911.         REM SHOW GETARCCOS
  3912.         REM $INCLUDE: 'SVGABC.BI'
  3913.         DEFINT A-Z
  3914.  
  3915.         VMODE = VIDEOMODEGET
  3916.         IF WHICHVGA = 0 THEN STOP
  3917.         DUMMY=RES640
  3918.         DRWBOX 1, 10, 0, 0, 639, 479
  3919.         DRWLINE 1, 10, 0, 240, 639, 240
  3920.         DRWLINE 1, 10, 320, 0, 320, 479
  3921.         DEG2RAD! = 4 * ATN(1) / 180
  3922.         FOR I = -8192 TO 8192 STEP 16
  3923.            Y1& = GETARCCOS(I)
  3924.            DRWPOINT 1, 12, 320 + Y1& * 3, 240 - I / 34
  3925.         NEXT I
  3926.         WHILE INKEY$ = ""
  3927.         WEND
  3928.         VIDEOMODESET VMODE
  3929.         END
  3930.  
  3931.  
  3932.  
  3933.                                      58
  3934.  
  3935.  
  3936.  
  3937.  
  3938.  
  3939.  
  3940.       GETARCSIN
  3941.  
  3942.         PROTOTYPE
  3943.  
  3944.         FUNCTION GETARCSIN (Value&)
  3945.  
  3946.         INPUT
  3947.  
  3948.         Value - number between -1 and +1 scaled up by 13 bits (8192)
  3949.  
  3950.         OUTPUT
  3951.  
  3952.         GETARCSIN returns the arc sine of Value in degrees.
  3953.  
  3954.         USAGE
  3955.  
  3956.         GETARCSIN returns the arc sine in degrees for the given value.
  3957.         The return will be between -90 and +90 degrees.  Value should
  3958.         be between -8192 and +8192 representing the range -1 to +1.
  3959.         Input values outside this range are invalid and GETARCSIN will
  3960.         return -32768. Floating point values are ignored.  This
  3961.         function uses an integer lookup table stored within the
  3962.         library in order to produce the fastest possible results.  No
  3963.         floating point arithmetic is used.  The scale factor of 13
  3964.         bits (8192) was chosen because this is the number of bits at
  3965.         which every change of one degree gives a change in the value
  3966.         of the sine (or cosine) function.
  3967.  
  3968.         SEE ALSO
  3969.  
  3970.         GETARCCOS, GETARCTAN, GETCOS, GETSIN, GETTAN
  3971.  
  3972.         EXAMPLE
  3973.  
  3974.         REM SHOW GETARCSIN
  3975.         REM $INCLUDE: 'SVGABC.BI'
  3976.         DEFINT A-Z
  3977.  
  3978.         VMODE = VIDEOMODEGET
  3979.         IF WHICHVGA = 0 THEN STOP
  3980.         DUMMY=RES640
  3981.         DRWBOX 1, 10, 0, 0, 639, 479
  3982.         DRWLINE 1, 10, 0, 240, 639, 240
  3983.         DRWLINE 1, 10, 320, 0, 320, 479
  3984.         DEG2RAD! = 4 * ATN(1) / 180
  3985.         FOR I = -8192 TO 8192 STEP 16
  3986.            Y1& = GETARCSIN(I)
  3987.            DRWPOINT 1, 12, 320 + Y1& * 3, 240 - I / 34
  3988.         NEXT I
  3989.         WHILE INKEY$ = ""
  3990.         WEND
  3991.         VIDEOMODESET VMODE
  3992.         END
  3993.  
  3994.  
  3995.  
  3996.                                      59
  3997.  
  3998.  
  3999.  
  4000.  
  4001.  
  4002.  
  4003.       GETARCTAN
  4004.  
  4005.         PROTOTYPE
  4006.  
  4007.         FUNCTION GETARCTAN (Value&)
  4008.  
  4009.         INPUT
  4010.  
  4011.         Value - long integer representing a decimal scaled up by 13
  4012.         bits (8192)
  4013.  
  4014.         OUTPUT
  4015.  
  4016.         GETARCTAN returns the arc tangent of Value in degrees.
  4017.  
  4018.         USAGE
  4019.  
  4020.         GETARCTAN returns the arc cosine in degrees for the given
  4021.         value.  The return will be between -89 and +89 degrees.  Value
  4022.         can be any long integer.  It is interpreted as a decimal
  4023.         scaled up by 8192 (13 bits). Floating point values are
  4024.         ignored.  This function uses an integer lookup table stored
  4025.         within the library in order to produce the fastest possible
  4026.         results.  No floating point arithmetic is used.  The scale
  4027.         factor of 13 bits (8192) was chosen because this is the number
  4028.         of bits at which every change of one degree gives a change in
  4029.         the value of the sine (or cosine) function.
  4030.  
  4031.         SEE ALSO
  4032.  
  4033.         GETARCCOS, GETARCSIN, GETCOS, GETSIN, GETTAN
  4034.  
  4035.         EXAMPLE
  4036.  
  4037.         REM SHOW GETARCTAN
  4038.         REM $INCLUDE: 'SVGABC.BI'
  4039.         DEFINT A-Z
  4040.  
  4041.         VMODE = VIDEOMODEGET
  4042.         IF WHICHVGA = 0 THEN STOP
  4043.         DUMMY=RES640
  4044.         DRWBOX 1, 10, 0, 0, 639, 479
  4045.         DRWLINE 1, 10, 0, 240, 639, 240
  4046.         DRWLINE 1, 10, 320, 0, 320, 479
  4047.         DEG2RAD! = 4 * ATN(1) / 180
  4048.         FOR I = -8192 TO 8192 STEP 16
  4049.            Y1& = GETARCTAN(I)
  4050.            Y2& = ATN(I / 8192) / DEG2RAD!
  4051.            DRWPOINT 1, 12, 320 + Y1& * 6, 240 - I / 34
  4052.            DRWPOINT 1, 15, 320 + Y2& * 6, 240 - I / 34
  4053.         NEXT I
  4054.         WHILE INKEY$ = ""
  4055.         WEND
  4056.         VIDEOMODESET VMODE
  4057.  
  4058.  
  4059.                                      60
  4060.  
  4061.  
  4062.  
  4063.  
  4064.  
  4065.  
  4066.         END
  4067.  
  4068.  
  4069.  
  4070.  
  4071.  
  4072.  
  4073.  
  4074.  
  4075.  
  4076.  
  4077.  
  4078.  
  4079.  
  4080.  
  4081.  
  4082.  
  4083.  
  4084.  
  4085.  
  4086.  
  4087.  
  4088.  
  4089.  
  4090.  
  4091.  
  4092.  
  4093.  
  4094.  
  4095.  
  4096.  
  4097.  
  4098.  
  4099.  
  4100.  
  4101.  
  4102.  
  4103.  
  4104.  
  4105.  
  4106.  
  4107.  
  4108.  
  4109.  
  4110.  
  4111.  
  4112.  
  4113.  
  4114.  
  4115.  
  4116.  
  4117.  
  4118.  
  4119.  
  4120.  
  4121.  
  4122.                                      61
  4123.  
  4124.  
  4125.  
  4126.  
  4127.  
  4128.  
  4129.       GETCOS
  4130.  
  4131.         PROTOTYPE
  4132.  
  4133.         FUNCTION GETCOS& (Angle&)
  4134.  
  4135.         INPUT
  4136.  
  4137.         Angle - angle in degrees
  4138.  
  4139.         OUTPUT
  4140.  
  4141.         GETCOS returns the cosine of Angle scaled up by 13 bits
  4142.         (8192).
  4143.  
  4144.         USAGE
  4145.  
  4146.         GETCOS returns the cosine of the specified angle.  Angle can
  4147.         be any long value; floating point values are ignored.  The
  4148.         return value has been multiplied by 8192.  This function uses
  4149.         an integer lookup table stored within the library in order to
  4150.         produce the fastest possible results.  No floating point
  4151.         arithmetic is used.  The scale factor of 13 bits (8192) was
  4152.         chosen because this is the number of bits at which every
  4153.         change of one degree gives a change in the value of the sine
  4154.         (or cosine) function.
  4155.  
  4156.         SEE ALSO
  4157.  
  4158.         GETARCCOS, GETARCSIN, GETARCTAN, GETSIN, GETTAN
  4159.  
  4160.         EXAMPLE
  4161.  
  4162.         REM SHOW GETCOS
  4163.         REM $INCLUDE: 'SVGABC.BI'
  4164.         DEFINT A-Z
  4165.  
  4166.         VMODE = VIDEOMODEGET
  4167.         IF WHICHVGA = 0 THEN STOP
  4168.         DUMMY=RES640
  4169.         DRWBOX 1, 10, 0, 0, 639, 479
  4170.         DRWLINE 1, 10, 0, 240, 639, 240
  4171.         DRWLINE 1, 10, 320, 0, 320, 479
  4172.         DEG2RAD! = 4 * ATN(1) / 180
  4173.         FOR I = -360 TO 360
  4174.            Y1& = GETCOS(I)
  4175.            Y1& = Y1& * 240 / 8192
  4176.            Y2& = 240 * COS(I * DEG2RAD!)
  4177.            DRWPOINT 1, 15, 320 + I, 240 - Y1&
  4178.            DRWPOINT 1, 12, 320 + I, 240 - Y2&
  4179.         NEXT I
  4180.         WHILE INKEY$ = ""
  4181.         WEND
  4182.         VIDEOMODESET VMODE
  4183.  
  4184.  
  4185.                                      62
  4186.  
  4187.  
  4188.  
  4189.  
  4190.  
  4191.  
  4192.         END
  4193.  
  4194.  
  4195.  
  4196.  
  4197.  
  4198.  
  4199.  
  4200.  
  4201.  
  4202.  
  4203.  
  4204.  
  4205.  
  4206.  
  4207.  
  4208.  
  4209.  
  4210.  
  4211.  
  4212.  
  4213.  
  4214.  
  4215.  
  4216.  
  4217.  
  4218.  
  4219.  
  4220.  
  4221.  
  4222.  
  4223.  
  4224.  
  4225.  
  4226.  
  4227.  
  4228.  
  4229.  
  4230.  
  4231.  
  4232.  
  4233.  
  4234.  
  4235.  
  4236.  
  4237.  
  4238.  
  4239.  
  4240.  
  4241.  
  4242.  
  4243.  
  4244.  
  4245.  
  4246.  
  4247.  
  4248.                                      63
  4249.  
  4250.  
  4251.  
  4252.  
  4253.  
  4254.  
  4255.       GETLASTSTRING
  4256.  
  4257.         PROTOTYPE
  4258.  
  4259.         SUB GETLASTSTRING (GfxBlk%)
  4260.  
  4261.         INPUT
  4262.  
  4263.         no input parameters
  4264.  
  4265.         OUTPUT
  4266.  
  4267.         no value returned
  4268.         GfxBlk - integer destination array holding bitmap of text
  4269.         block
  4270.  
  4271.         USAGE
  4272.  
  4273.         GETLASTSTRING returns the text drawn on the screen by the last
  4274.         called DRWSTRING function.  The text is returned in GfxBlk
  4275.         which may be used with BLKPUT or the sprite functions.  The
  4276.         text in GfxBlk is oriented in the same manner as the last
  4277.         called DRWSTRING function.  The intended use is to call the
  4278.         DRWSTRING function using mode 0 which does not actually draw
  4279.         text on the screen.  GETLASTSTRING should be called
  4280.         immediately after the DRWSTRING function to prevent possible
  4281.         loss of data caused by other functions.
  4282.  
  4283.         GfxBlk must be dimensioned as a short integer array with a
  4284.         size in integers equal to
  4285.  
  4286.             [(fontwidth*stringlength)*(fontheight)] / 2+3.
  4287.  
  4288.         The font's dimensions can be obtained by calling FONTGETINFO
  4289.         and the string's length can be obtained using Basic's LEN
  4290.         function.  Note, however, that GfxBlk can be quite large.  If
  4291.         the size of GfxBlk is insufficient, GETLASTSTRING will
  4292.         overwrite any data in memory contained beyond GfxBlk and may
  4293.         possibly cause the system to crash.
  4294.  
  4295.         Arrays should be passed by giving the element within the array
  4296.         from where the action should take place.  This allows the
  4297.         programmer to store more than one item within the same array
  4298.         or act on only a portion of the array.
  4299.  
  4300.         SEE ALSO
  4301.  
  4302.         BLKPUT, DRWSTRING, DRWSTRINGDN, DRWSTRINGLT, DRWSTRINGRT,
  4303.         FONTGETINFO
  4304.  
  4305.         EXAMPLE
  4306.  
  4307.         REM USES GETLASTSTRING TO DRAW SOME TEXT AT THE CENTER OF THE
  4308.         SCREEN
  4309.  
  4310.  
  4311.                                      64
  4312.  
  4313.  
  4314.  
  4315.  
  4316.  
  4317.  
  4318.         REM $INCLUDE: 'SVGABC.BI'
  4319.         DEFINT A-Z
  4320.  
  4321.         VMODE=VIDEOMODEGET
  4322.         IF WHICHVGA = 0 THEN STOP
  4323.         DUMMY=RES640
  4324.         A$ = "HELLO WORLD"
  4325.         DRWSTRING 0, 10, 0, A$, 0, 0
  4326.         FONTGETINFO W, H
  4327.         L = LEN(A$)
  4328.         BLKSIZE = ( (W*L)*H )\2 + 3
  4329.         DIM BLK(0 TO BLKSIZE)
  4330.         GETLASTSTRING BLK(0)
  4331.         BLKPUT 1, 320, 240, BLK(0)
  4332.         WHILE INKEY$ = ""
  4333.         WEND
  4334.         VIDEOMODESET VMODE
  4335.         END
  4336.  
  4337.  
  4338.  
  4339.  
  4340.  
  4341.  
  4342.  
  4343.  
  4344.  
  4345.  
  4346.  
  4347.  
  4348.  
  4349.  
  4350.  
  4351.  
  4352.  
  4353.  
  4354.  
  4355.  
  4356.  
  4357.  
  4358.  
  4359.  
  4360.  
  4361.  
  4362.  
  4363.  
  4364.  
  4365.  
  4366.  
  4367.  
  4368.  
  4369.  
  4370.  
  4371.  
  4372.  
  4373.  
  4374.                                      65
  4375.  
  4376.  
  4377.  
  4378.  
  4379.  
  4380.  
  4381.       GETMAXX
  4382.  
  4383.         PROTOTYPE
  4384.  
  4385.         FUNCTION GETMAXX% ()
  4386.  
  4387.         INPUT
  4388.  
  4389.         no input parameters
  4390.  
  4391.         OUTPUT
  4392.  
  4393.         GETMAXX returns the current horizontal resolution of the
  4394.         screen.
  4395.  
  4396.         USAGE
  4397.  
  4398.         GETMAXX returns the horizontal resolution of the screen in the
  4399.         current mode.  This function should only be called if one of
  4400.         the RES### functions has been previously called.  Otherwise,
  4401.         the value returned is meaningless.
  4402.  
  4403.         SEE ALSO
  4404.  
  4405.         GETMAXY
  4406.  
  4407.         EXAMPLE
  4408.  
  4409.         REM SHOW GETMAXX
  4410.         REM $INCLUDE: 'SVGABC.BI'
  4411.         DEFINT A-Z
  4412.  
  4413.         VMODE = VIDEOMODEGET
  4414.         IF WHICHVGA = 0 THEN STOP
  4415.         DUMMY=RES640
  4416.         X$ = "MAX X SCREEN VALUE IS:" + STR$(GETMAXX)
  4417.         DRWSTRING 1, 7, 0, X$, 0, 0
  4418.         SETVIEW 0, 0, 400, 479
  4419.         X$ = "MAX X SCREEN VALUE IS STILL:" + STR$(GETMAXX)
  4420.         DRWSTRING 1, 7, 0, X$, 0, 20
  4421.         WHILE INKEY$ = ""
  4422.         WEND
  4423.         VIDEOMODESET VMODE
  4424.         END
  4425.  
  4426.  
  4427.  
  4428.  
  4429.  
  4430.  
  4431.  
  4432.  
  4433.  
  4434.  
  4435.  
  4436.  
  4437.                                      66
  4438.  
  4439.  
  4440.  
  4441.  
  4442.  
  4443.  
  4444.       GETMAXY
  4445.  
  4446.         PROTOTYPE
  4447.  
  4448.         FUNCTION GETMAXY% ()
  4449.  
  4450.         INPUT
  4451.  
  4452.         no input parameters
  4453.  
  4454.         OUTPUT
  4455.  
  4456.         GETMAXY returns the current vertical resolution of the screen.
  4457.  
  4458.         USAGE
  4459.  
  4460.         GETMAXY returns the vertical resolution of the screen in the
  4461.         current mode.  This function should only be called if one of
  4462.         the RES### functions has been previously called.  Otherwise,
  4463.         the value returned is meaningless.
  4464.  
  4465.         SEE ALSO
  4466.  
  4467.         GETMAXX
  4468.  
  4469.         EXAMPLE
  4470.  
  4471.         REM SHOW GETMAXY
  4472.         REM $INCLUDE: 'SVGABC.BI'
  4473.         DEFINT A-Z
  4474.  
  4475.         VMODE = VIDEOMODEGET
  4476.         IF WHICHVGA = 0 THEN STOP
  4477.         DUMMY=RES640
  4478.         Y$ = "MAX Y SCREEN VALUE IS:" + STR$(GETMAXY)
  4479.         DRWSTRING 1, 7, 0, Y$, 0, 0
  4480.         SETVIEW 0, 0, 639, 200
  4481.         Y$ = "MAX Y SCREEN VALUE IS STILL:" + STR$(GETMAXY)
  4482.         DRWSTRING 1, 7, 0, Y$, 0, 20
  4483.         WHILE INKEY$ = ""
  4484.         WEND
  4485.         VIDEOMODESET VMODE
  4486.         END
  4487.  
  4488.  
  4489.  
  4490.  
  4491.  
  4492.  
  4493.  
  4494.  
  4495.  
  4496.  
  4497.  
  4498.  
  4499.  
  4500.                                      67
  4501.  
  4502.  
  4503.  
  4504.  
  4505.  
  4506.  
  4507.       GETPOINT
  4508.  
  4509.         PROTOTYPE
  4510.  
  4511.         FUNCTION GETPOINT% (X%, Y%)
  4512.  
  4513.         INPUT
  4514.  
  4515.         X, Y - location of pixel to read
  4516.  
  4517.         OUTPUT
  4518.  
  4519.         GETPOINT returns the color index of pixel at X, Y.
  4520.  
  4521.         USAGE
  4522.  
  4523.         GETPOINT returns the value of the pixel at location X, Y.
  4524.         This value is a color index into the current palette.
  4525.  
  4526.         SEE ALSO
  4527.  
  4528.         DRWPOINT
  4529.  
  4530.         EXAMPLE
  4531.  
  4532.         REM DRAW A POINT AND CHECK TO MAKE SURE IT IS THERE
  4533.         REM $INCLUDE: 'SVGABC.BI'
  4534.  
  4535.         DEFINT A-Z
  4536.         IF WHICHVGA = 0 THEN STOP
  4537.         IF WHICHMEM < 512 THEN STOP
  4538.         VMODE = VIDEOMODEGET
  4539.         DUMMY=RES640
  4540.         DRWPOINT 1, 10, 320, 240
  4541.         POINTVALUE = GETPOINT(320, 240)
  4542.         A$ = "THE POINT VALUE IS:" + STR$(POINTVALUE)
  4543.         DRWSTRING 1, 7, 0, A$, 0, 0
  4544.         WHILE INKEY$ = ""
  4545.         WEND
  4546.         VIDEOMODESET VMODE
  4547.         END
  4548.  
  4549.  
  4550.  
  4551.  
  4552.  
  4553.  
  4554.  
  4555.  
  4556.  
  4557.  
  4558.  
  4559.  
  4560.  
  4561.  
  4562.  
  4563.                                      68
  4564.  
  4565.  
  4566.  
  4567.  
  4568.  
  4569.  
  4570.       GETSIN
  4571.  
  4572.         PROTOTYPE
  4573.  
  4574.         FUNCTION GETSIN& (Angle&)
  4575.  
  4576.         INPUT
  4577.  
  4578.         Angle - angle in degrees
  4579.  
  4580.         OUTPUT
  4581.  
  4582.         GETSIN returns the sine of Angle scaled up by 13 bits (8192).
  4583.  
  4584.         USAGE
  4585.  
  4586.         GETSIN returns the sine of the specified angle.  Angle can be
  4587.         any long value; floating point values are ignored.  The return
  4588.         value has been multiplied by 8192.  This function uses an
  4589.         integer lookup table stored within the library in order to
  4590.         produce the fastest possible results.  No floating point
  4591.         arithmetic is used.  The scale factor of 13 bits (8192) was
  4592.         chosen because this is the number of bits at which every
  4593.         change of one degree gives a change in the value of the sine
  4594.         (or cosine) function.
  4595.  
  4596.         SEE ALSO
  4597.  
  4598.         GETARCCOS, GETARCSIN, GETARCTAN, GETCOS, GETTAN
  4599.  
  4600.         EXAMPLE
  4601.  
  4602.         REM SHOW GETSIN
  4603.         REM $INCLUDE: 'SVGABC.BI'
  4604.         DEFINT A-Z
  4605.  
  4606.         VMODE = VIDEOMODEGET
  4607.         IF WHICHVGA = 0 THEN STOP
  4608.         DUMMY=RES640
  4609.         DRWBOX 1, 10, 0, 0, 639, 479
  4610.         DRWLINE 1, 10, 0, 240, 639, 240
  4611.         DRWLINE 1, 10, 320, 0, 320, 479
  4612.         DEG2RAD! = 4 * ATN(1) / 180
  4613.         FOR I = -360 TO 360
  4614.            Y1& = GETSIN(I)
  4615.            Y1& = Y1& * 240 / 8192
  4616.            Y2& = 240 * SIN(I * DEG2RAD!)
  4617.            DRWPOINT 1, 15, 320 + I, 240 - Y1&
  4618.            DRWPOINT 1, 12, 320 + I, 240 - Y2&
  4619.         NEXT I
  4620.         WHILE INKEY$ = ""
  4621.         WEND
  4622.         VIDEOMODESET VMODE
  4623.         END
  4624.  
  4625.  
  4626.                                      69
  4627.  
  4628.  
  4629.  
  4630.  
  4631.  
  4632.  
  4633.       GETTAN
  4634.  
  4635.         PROTOTYPE
  4636.  
  4637.         FUNCTION GETTAN& (Angle%)
  4638.  
  4639.         INPUT
  4640.  
  4641.         Angle - angle in degrees
  4642.  
  4643.         OUTPUT
  4644.  
  4645.         GETTAN returns the tangent of Angle scaled up by 13 bits
  4646.         (8192).
  4647.  
  4648.         USAGE
  4649.  
  4650.         GETTAN returns the tangent of the specified angle.  Angle can
  4651.         be any long value except +(90+n*180), where n is an integer.
  4652.         Floating point values are ignored.  The return value has been
  4653.         multiplied by 8192.  If an invalid angle is given, the GETTAN
  4654.         will return &H80000000 (-2147483648).  This function uses an
  4655.         integer lookup table stored within the library in order to
  4656.         produce the fastest possible results.  No floating point
  4657.         arithmetic is used.  The scale factor of 13 bits (8192) was
  4658.         chosen because this is the number of bits at which every
  4659.         change of one degree gives a change in the value of the sine
  4660.         (or cosine) function.
  4661.  
  4662.         SEE ALSO
  4663.  
  4664.         GETARCCOS, GETARCSIN, GETARCTAN, GETCOS, GETSIN
  4665.  
  4666.         EXAMPLE
  4667.  
  4668.         REM SHOW GETTAN
  4669.         REM $INCLUDE: 'SVGABC.BI'
  4670.         DEFINT A-Z
  4671.  
  4672.         VMODE = VIDEOMODEGET
  4673.         IF WHICHVGA = 0 THEN STOP
  4674.         DUMMY=RES640
  4675.         DRWBOX 1, 10, 0, 0, 639, 479
  4676.         DRWLINE 1, 10, 0, 240, 639, 240
  4677.         DRWLINE 1, 10, 320, 0, 320, 479
  4678.         DEG2RAD! = 4 * ATN(1) / 180
  4679.         FOR I = -360 TO 360
  4680.            IF ((I - 90) / 180) <> INT((I - 90) / 180) THEN
  4681.          Y1& = GETTAN(I)
  4682.          Y1& = Y1& * 240 / 8192
  4683.          Y2& = 240 * TAN(I * DEG2RAD!)
  4684.          DRWPOINT 1, 15, 320 + I, 240 - Y1&
  4685.          DRWPOINT 1, 12, 320 + I, 240 - Y2&
  4686.            END IF
  4687.  
  4688.  
  4689.                                      70
  4690.  
  4691.  
  4692.  
  4693.  
  4694.  
  4695.  
  4696.         NEXT I
  4697.         WHILE INKEY$ = ""
  4698.         WEND
  4699.         VIDEOMODESET VMODE
  4700.         END
  4701.  
  4702.  
  4703.  
  4704.  
  4705.  
  4706.  
  4707.  
  4708.  
  4709.  
  4710.  
  4711.  
  4712.  
  4713.  
  4714.  
  4715.  
  4716.  
  4717.  
  4718.  
  4719.  
  4720.  
  4721.  
  4722.  
  4723.  
  4724.  
  4725.  
  4726.  
  4727.  
  4728.  
  4729.  
  4730.  
  4731.  
  4732.  
  4733.  
  4734.  
  4735.  
  4736.  
  4737.  
  4738.  
  4739.  
  4740.  
  4741.  
  4742.  
  4743.  
  4744.  
  4745.  
  4746.  
  4747.  
  4748.  
  4749.  
  4750.  
  4751.  
  4752.                                      71
  4753.  
  4754.  
  4755.  
  4756.  
  4757.  
  4758.  
  4759.       GIFGETINFO
  4760.  
  4761.         PROTOTYPE
  4762.  
  4763.         FUNCTION GIFGETINFO% (Filename$, Width%, Height%, NumColors%,
  4764.         Palette$)
  4765.  
  4766.         INPUT
  4767.  
  4768.         Filename$ - the filename of the GIF image to read
  4769.  
  4770.         OUTPUT
  4771.  
  4772.         GIFGETINFO returns the status of the function (1 = success).
  4773.         Width - the width in pixels of the image
  4774.         Height - the height in pixels of the image
  4775.         NumColors - the number of colors in the image palette
  4776.         Palette$ - string*768 containing the image palette
  4777.  
  4778.         USAGE
  4779.  
  4780.         GIFGETINFO reads Filename$ and returns the characteristics of
  4781.         the image.  The dimensions of the image are returned in Width,
  4782.         Height.  The number of colors in the image's palette is
  4783.         returned in NumColors and the palette is returned in Palette$.
  4784.         Although the image's palette may contain less than 256 colors,
  4785.         Palette$ must be 768 characters in length.  The image's
  4786.         palette will begin with the first character of Palette$.
  4787.  
  4788.         For ease of programming the GIF decoder requires that the
  4789.         image be non-interlaced, use only a global color map and be
  4790.         compressed according to GIF87a specifications.
  4791.  
  4792.         If GIFGETINFO determines that Filename$ is a satisfactory
  4793.         file, the function will return a one.  Otherwise, the function
  4794.         will return one of several error codes concerning Filename$ as
  4795.         listed below:
  4796.  
  4797.         0 =  does not exist or there is some disk I/O problem
  4798.         -1 = does not have the GIF87a signature
  4799.         -2 = image is interlaced
  4800.         -3 = does not use a global color map
  4801.         -4 = has some general error
  4802.  
  4803.         SEE ALSO
  4804.  
  4805.         GIFMAKE, GIFPUT
  4806.  
  4807.         EXAMPLE
  4808.  
  4809.         REM GET THE INFORMATION OF THE GIF FILE 'UTTOWER.GIF'
  4810.         REM $INCLUDE: 'SVGABC.BI'
  4811.         DEFINT A-Z
  4812.         DIM GIFPAL AS STRING * 768
  4813.  
  4814.  
  4815.                                      72
  4816.  
  4817.  
  4818.  
  4819.  
  4820.  
  4821.  
  4822.  
  4823.         CLS
  4824.         GIFFILENAME$="UTTOWER.GIF"
  4825.         PRINT
  4826.         OK = GIFGETINFO(GIFFILENAME$, XSIZE, YSIZE, NUMCOL, GIFPAL)
  4827.         IF OK = 1 THEN
  4828.            A$ = "'" + GIFFILENAME$ + "' is identified as a 'Non-
  4829.         Interlaced' type GIF"
  4830.            A$ = A$ + "'GIF87a' GIF."
  4831.            PRINT A$
  4832.            A$ = "Dimensions are:" + STR$(XSIZE) + " pixels wide and" +
  4833.         STR$(YSIZE)
  4834.            A$ = A$ + " pixels high"
  4835.            PRINT A$
  4836.            A$ = "Number of colors:" + STR$(NUMCOL)
  4837.            PRINT A$
  4838.         END IF
  4839.         WHILE INKEY$ = ""
  4840.         WEND
  4841.         END
  4842.  
  4843.  
  4844.  
  4845.  
  4846.  
  4847.  
  4848.  
  4849.  
  4850.  
  4851.  
  4852.  
  4853.  
  4854.  
  4855.  
  4856.  
  4857.  
  4858.  
  4859.  
  4860.  
  4861.  
  4862.  
  4863.  
  4864.  
  4865.  
  4866.  
  4867.  
  4868.  
  4869.  
  4870.  
  4871.  
  4872.  
  4873.  
  4874.  
  4875.  
  4876.  
  4877.  
  4878.                                      73
  4879.  
  4880.  
  4881.  
  4882.  
  4883.  
  4884.  
  4885.       GIFMAKE
  4886.  
  4887.         PROTOTYPE
  4888.  
  4889.         FUNCTION GIFMAKE% (X1%, Y1%, X2%, Y2%, Filename$)
  4890.  
  4891.         INPUT
  4892.  
  4893.         X1, Y1 - the location of the top, left corner of the image
  4894.         X2, Y2 - the bottom, right corner of the image
  4895.         Filename$ - filename to store the GIF image
  4896.  
  4897.         OUTPUT
  4898.  
  4899.         GIFMAKE returns a 1 if successful, 0 if unsuccessful.
  4900.  
  4901.         USAGE
  4902.  
  4903.         GIFMAKE takes the bitmap enclosed in the box defined by (X1,
  4904.         Y1) - (X2, Y2) and writes a GIF with the filename specified by
  4905.         Filename$.  The resulting file uses the GIF87a compression
  4906.         specifications.  X1, Y1, X2 and Y2 must be valid coordinates
  4907.         on the currently active page.  Filename$ may specify a full
  4908.         path and drive letter, if necessary.
  4909.  
  4910.         SEE ALSO
  4911.  
  4912.         GIFGETINFO, GIFPUT
  4913.  
  4914.         EXAMPLE
  4915.  
  4916.         REM MAKE A 256 COLOR GIF FILE
  4917.         REM $INCLUDE: 'SVGABC.BI'
  4918.         DEFINT A-Z
  4919.         DIM DT(0 TO 10000) AS INTEGER
  4920.         IF WHICHCPU < 386 THEN END
  4921.         IF WHICHVGA = 0 THEN END
  4922.         VMODE = VIDEOMODEGET
  4923.         DUMMY = RES640
  4924.         FILLSCREEN 10
  4925.         FOR A = 0 TO 200
  4926.            X1 = RND * GETMAXX
  4927.            Y1 = RND * GETMAXY
  4928.            X2 = RND * GETMAXX
  4929.            Y2 = RND * GETMAXY
  4930.            C = RND * 255
  4931.            DRWLINE 1, C, X1, Y1, X2, Y2
  4932.         NEXT A
  4933.         DRWBOX 1, 15, 0, 0, GETMAXX, GETMAXY
  4934.         A$ = "This GIF file was created using Zephyr Software's
  4935.         'GIFMAKE' function!"
  4936.         DRWSTRING 1, 15, 0, A$, 2, 2
  4937.         ER = GIFMAKE(0, 0, GETMAXX, GETMAXY, "TEST.GIF")
  4938.         VIDEOMODESET VMODE
  4939.  
  4940.  
  4941.                                      74
  4942.  
  4943.  
  4944.  
  4945.  
  4946.  
  4947.  
  4948.         IF ER <> 1 THEN
  4949.            PRINT "GIF MAKE ERROR!"
  4950.         END IF
  4951.         END
  4952.  
  4953.  
  4954.  
  4955.  
  4956.  
  4957.  
  4958.  
  4959.  
  4960.  
  4961.  
  4962.  
  4963.  
  4964.  
  4965.  
  4966.  
  4967.  
  4968.  
  4969.  
  4970.  
  4971.  
  4972.  
  4973.  
  4974.  
  4975.  
  4976.  
  4977.  
  4978.  
  4979.  
  4980.  
  4981.  
  4982.  
  4983.  
  4984.  
  4985.  
  4986.  
  4987.  
  4988.  
  4989.  
  4990.  
  4991.  
  4992.  
  4993.  
  4994.  
  4995.  
  4996.  
  4997.  
  4998.  
  4999.  
  5000.  
  5001.  
  5002.  
  5003.  
  5004.                                      75
  5005.  
  5006.  
  5007.  
  5008.  
  5009.  
  5010.  
  5011.       GIFPUT
  5012.  
  5013.         PROTOTYPE
  5014.  
  5015.         FUNCTION GIFPUT (Mode%, X%, Y%, Filename$)
  5016.  
  5017.         INPUT
  5018.  
  5019.         Mode - pixel write mode (SET=1, XOR=2, OR=3, AND=4)
  5020.         X, Y - the location of the top, left corner of the GIF image
  5021.         Filename$ - filename of the GIF image to read
  5022.  
  5023.         OUTPUT
  5024.  
  5025.         GIFPUT returns the status of the function (1 = success).
  5026.  
  5027.         USAGE
  5028.  
  5029.         GIFPUT reads the GIF image from Filename$ and places it on the
  5030.         screen with the top, left corner at X, Y.  The image is
  5031.         automatically clipped to the currently defined viewport.  The
  5032.         image's palette should be previously obtained by using
  5033.         GIFGETINFO.
  5034.  
  5035.         For ease of programming the GIF decoder requires that the
  5036.         image be non-interlaced, use only a global color map and be
  5037.         compressed according to GIF87a specifications.
  5038.  
  5039.         If GIFPUT encounters no problems, the function will return a
  5040.         one.  Otherwise, the function will return one of several error
  5041.         codes concerning Filename$ as listed below:
  5042.  
  5043.         0 =  does not exist or there is some disk I/O problem
  5044.         -1 = does not have the GIF87a signature
  5045.         -2 = image is interlaced
  5046.         -3 = does not use a global color map
  5047.         -4 = has some general error
  5048.  
  5049.         SEE ALSO
  5050.  
  5051.         GIFGETINFO, GIFMAKE, SETVIEW
  5052.  
  5053.         EXAMPLE
  5054.  
  5055.         REM DISPLAY THE GIF FILE 'UTTOWER.GIF'
  5056.         REM $INCLUDE: 'SVGABC.BI'
  5057.         DEFINT A-Z
  5058.         DIM GIFPAL AS STRING * 768
  5059.  
  5060.         IF WHICHVGA = 0 THEN STOP
  5061.         IF WHICHMEM < 512 THEN STOP
  5062.         GIFFILENAME$="UTTOWER.GIF"
  5063.         VMODE = VIDEOMODEGET
  5064.         DUMMY=RES640
  5065.  
  5066.  
  5067.                                      76
  5068.  
  5069.  
  5070.  
  5071.  
  5072.  
  5073.  
  5074.         OK = GIFGETINFO(GIFFILENAME$, XSIZE, YSIZE, NUMCOL, GIFPAL)
  5075.         IF OK = 1 THEN
  5076.            FIXIT = 0
  5077.            FOR A = 1 TO NUMCOL * 3 STEP 3
  5078.          R = ASC(MID$(GIFPAL, A, 1))
  5079.          G = ASC(MID$(GIFPAL, A + 1, 1))
  5080.          B = ASC(MID$(GIFPAL, A + 2, 1))
  5081.          IF R > 63 THEN
  5082.             FIXIT = 1
  5083.             EXIT FOR
  5084.          END IF
  5085.          IF G > 63 THEN
  5086.             FIXIT = 1
  5087.             EXIT FOR
  5088.          END IF
  5089.          IF B > 63 THEN
  5090.             FIXIT = 1
  5091.             EXIT FOR
  5092.          END IF
  5093.            NEXT A
  5094.            IF FIXIT = 1 THEN
  5095.          FOR A = 1 TO NUMCOL * 3
  5096.             C = ASC(MID$(GIFPAL, A, 1))
  5097.             MID$(GIFPAL, A, 1) = CHR$(C \ 4)
  5098.            NEXT A
  5099.            END IF
  5100.            PALSET GIFPAL, 0, 255
  5101.            OK = GIFPUT(1, 0, 0, GIFFILENAME$)
  5102.            IF OK <> 1 THEN
  5103.          SOUND 100, 5
  5104.            END IF
  5105.         END IF
  5106.         WHILE INKEY$ = ""
  5107.         WEND
  5108.         VIDEOMODESET VMODE
  5109.         END
  5110.  
  5111.  
  5112.  
  5113.  
  5114.  
  5115.  
  5116.  
  5117.  
  5118.  
  5119.  
  5120.  
  5121.  
  5122.  
  5123.  
  5124.  
  5125.  
  5126.  
  5127.  
  5128.  
  5129.  
  5130.                                      77
  5131.  
  5132.  
  5133.  
  5134.  
  5135.  
  5136.  
  5137.       JOYSTICKINFO
  5138.  
  5139.         PROTOTYPE
  5140.  
  5141.         SUB JOYSTICKINFO (JAX%, JAY%, JAButs%, JBX%, JBY%, JBButs%)
  5142.  
  5143.         INPUT
  5144.  
  5145.         no input parameters
  5146.  
  5147.         OUTPUT
  5148.  
  5149.         no value returned
  5150.         JAX, JAY - horizontal and vertical values of joystick A
  5151.         JAButs - button status of joystick A
  5152.         JBX, JBY - horizontal and vertical values of joystick B
  5153.         JBButs - button status of joystick B
  5154.  
  5155.         USAGE
  5156.  
  5157.         JOYSTICKINFO returns the current status of the two joysticks'
  5158.         position and buttons.  The position is returned in JAX, JAY
  5159.         for joystick A and JBX, JBY for joystick B.  The buttons'
  5160.         status is held in JAButs and JBButs.  For each joystick,
  5161.         button A - usually the fire button - is held in bit zero and
  5162.         button B is in bit one.  Button status is most easily checked
  5163.         with a bitwise AND of JAButs (or JBButs) and the desired bit.
  5164.  
  5165.         Not all joysticks are constructed the same.  In addition,
  5166.         joysticks are not linear devices.  The value of its center
  5167.         will not necessarily be the mean of its extreme values.
  5168.         Therefore, it is recommended that any program using the
  5169.         joystick for more than just directional control complete a
  5170.         calibration of the joystick prior to usage.  For an example of
  5171.         joystick calibration, see the SVGADEMO.EXE source code.
  5172.  
  5173.         SEE ALSO
  5174.  
  5175.         WHICHJOYSTICK
  5176.  
  5177.         EXAMPLE
  5178.  
  5179.         REM DISPLAY THE STATUS OF THE JOYSTICK PORT
  5180.         REM $INCLUDE: 'SVGABC.BI'
  5181.         DEFINT A-Z
  5182.  
  5183.         CLS
  5184.         WHILE INKEY$ = ""
  5185.            JOYSTICKINFO JAX, JAY, JAButs, JBX, JBY, JBButs
  5186.            LOCATE 1, 1
  5187.            PRINT STRING$(40, 32)
  5188.            LOCATE 1, 1
  5189.            PRINT JAX; JAY; JAButs, JBX; JBY; JBButs;
  5190.            SDELAY 4
  5191.  
  5192.  
  5193.                                      78
  5194.  
  5195.  
  5196.  
  5197.  
  5198.  
  5199.  
  5200.         WEND
  5201.         END
  5202.  
  5203.  
  5204.  
  5205.  
  5206.  
  5207.  
  5208.  
  5209.  
  5210.  
  5211.  
  5212.  
  5213.  
  5214.  
  5215.  
  5216.  
  5217.  
  5218.  
  5219.  
  5220.  
  5221.  
  5222.  
  5223.  
  5224.  
  5225.  
  5226.  
  5227.  
  5228.  
  5229.  
  5230.  
  5231.  
  5232.  
  5233.  
  5234.  
  5235.  
  5236.  
  5237.  
  5238.  
  5239.  
  5240.  
  5241.  
  5242.  
  5243.  
  5244.  
  5245.  
  5246.  
  5247.  
  5248.  
  5249.  
  5250.  
  5251.  
  5252.  
  5253.  
  5254.  
  5255.  
  5256.                                      79
  5257.  
  5258.  
  5259.  
  5260.  
  5261.  
  5262.  
  5263.       MOUSEBUTPRESS
  5264.  
  5265.         PROTOTYPE
  5266.  
  5267.         SUB MOUSEBUTPRESS (ReqButton%, X%, Y%, Num%, MouseButs%)
  5268.  
  5269.         INPUT
  5270.  
  5271.         ReqButton - button for which information is requested
  5272.  
  5273.         OUTPUT
  5274.  
  5275.         no value returned
  5276.         X, Y - current location of mouse cursor
  5277.         Num - number of times button has been pressed since last
  5278.         request
  5279.         MouseButs - current status of the mouse buttons
  5280.  
  5281.         USAGE
  5282.  
  5283.         MOUSEBUTPRESS returns in Num the number of times a mouse
  5284.         button has been pressed since the last call to MOUSEBUTPRESS.
  5285.         In addition the current status of the mouse cursor and buttons
  5286.         is returned.  The position is returned in X, Y.  The buttons'
  5287.         status is held in MouseButs.  The left button is held in bit
  5288.         zero, right button in bit one and center button - for three
  5289.         button mice - in bit two.  Button status is most easily
  5290.         checked with a bitwise AND of MouseButs and the desired bit.
  5291.         The button for which a history is desired is identified by the
  5292.         bits in ReqButton.  However, only one bit may be set.
  5293.         Therefore, only the values of 1, 2 and 4 are permitted.  If
  5294.         more than one bit in ReqButton is set, the function will exit
  5295.         and no information will be returned.
  5296.  
  5297.         SEE ALSO
  5298.  
  5299.         MOUSEBUTRELEASE, MOUSESTATUS
  5300.  
  5301.         EXAMPLE
  5302.  
  5303.         REM ENABLE, SHOW, MOUSE / DISPLAY LEFT BUTTON PRESS HISTORY
  5304.         REM FOR THE LAST 2 SECONDS
  5305.         REM $INCLUDE: 'SVGABC.BI'
  5306.         DEFINT A-Z
  5307.  
  5308.         VMODE = VIDEOMODEGET
  5309.         IF WHICHVGA = 0 THEN STOP
  5310.         IF WHICHMOUSE = 0 THEN STOP
  5311.         DUMMY=RES640
  5312.         MOUSEENTER
  5313.         MOUSESHOW
  5314.         WHILE INKEY$ = ""
  5315.            MOUSEBUTPRESS 1, X, Y, N, MBUTS
  5316.            D$ = "MX=" + STR$(X)
  5317.  
  5318.  
  5319.                                      80
  5320.  
  5321.  
  5322.  
  5323.  
  5324.  
  5325.  
  5326.            L = LEN(D$)
  5327.            IF L < 10 THEN
  5328.          D$ = D$ + STRING$(8 - L, 32)
  5329.            END IF
  5330.            D$ = D$ + "MY=" + STR$(Y)
  5331.            L = LEN(D$)
  5332.            IF L < 20 THEN
  5333.          D$ = D$ + STRING$(16 - L, 32)
  5334.            END IF
  5335.            D$ = D$ + "Number Of Times=" + STR$(N)
  5336.            DRWSTRING 1, 15, 8, D$, 0, 0
  5337.            SDELAY 80
  5338.         WEND
  5339.         MOUSEEXIT
  5340.         VIDEOMODESET VMODE
  5341.         END
  5342.  
  5343.  
  5344.  
  5345.  
  5346.  
  5347.  
  5348.  
  5349.  
  5350.  
  5351.  
  5352.  
  5353.  
  5354.  
  5355.  
  5356.  
  5357.  
  5358.  
  5359.  
  5360.  
  5361.  
  5362.  
  5363.  
  5364.  
  5365.  
  5366.  
  5367.  
  5368.  
  5369.  
  5370.  
  5371.  
  5372.  
  5373.  
  5374.  
  5375.  
  5376.  
  5377.  
  5378.  
  5379.  
  5380.  
  5381.  
  5382.                                      81
  5383.  
  5384.  
  5385.  
  5386.  
  5387.  
  5388.  
  5389.       MOUSEBUTRELEASE
  5390.  
  5391.         PROTOTYPE
  5392.  
  5393.         SUB MOUSEBUTRELEASE (ReqButton%, X%, Y%, Num%, MouseButs%)
  5394.  
  5395.         INPUT
  5396.  
  5397.         ReqButton - button for which information is requested
  5398.  
  5399.         OUTPUT
  5400.  
  5401.         no value returned
  5402.         X, Y - current location of mouse cursor
  5403.         Num - number of times button has been released since last
  5404.         request
  5405.         MouseButs - current status of mouse buttons
  5406.  
  5407.         USAGE
  5408.  
  5409.         MOUSEBUTRELEASE returns in Num the number of times a mouse
  5410.         button has been released since the last call to
  5411.         MOUSEBUTRELEASE.  In addition the current status of the mouse
  5412.         cursor and buttons is returned.  The position is returned in
  5413.         X, Y.  The buttons' status is held in MouseButs.  The left
  5414.         button is held in bit zero, right button in bit one and center
  5415.         button - for three button mice - in bit two.  Button status is
  5416.         most easily checked with a bitwise AND of MouseButs and the
  5417.         desired bit.  The button for which a history is desired is
  5418.         identified by the bits in ReqButton.  However, only one bit
  5419.         may be set.  Therefore, only the values of 1, 2 and 4 are
  5420.         permitted.  If more than one bit in ReqButton is set, the
  5421.         function will exit and no information will be returned.
  5422.  
  5423.         SEE ALSO
  5424.  
  5425.         MOUSEBUTPRESS, MOUSESTATUS
  5426.  
  5427.         EXAMPLE
  5428.  
  5429.         REM ENABLE, SHOW, MOUSE / DISPLAY LEFT BUTTON RELEASE HISTORY
  5430.         REM FOR THE LAST 2 SECONDS
  5431.         REM $INCLUDE: 'SVGABC.BI'
  5432.         DEFINT A-Z
  5433.  
  5434.         VMODE = VIDEOMODEGET
  5435.         IF WHICHVGA = 0 THEN STOP
  5436.         IF WHICHMOUSE = 0 THEN STOP
  5437.         DUMMY=RES640
  5438.         MOUSEENTER
  5439.         MOUSESHOW
  5440.         WHILE INKEY$ = ""
  5441.            MOUSEBUTRELEASE 1, X, Y, N, MBUTS
  5442.            D$ = "MX=" + STR$(X)
  5443.  
  5444.  
  5445.                                      82
  5446.  
  5447.  
  5448.  
  5449.  
  5450.  
  5451.  
  5452.            L = LEN(D$)
  5453.            IF L < 10 THEN
  5454.            D$ = D$ + STRING$(8 - L, 32)
  5455.            END IF
  5456.            D$ = D$ + "MY=" + STR$(Y)
  5457.            L = LEN(D$)
  5458.            IF L < 20 THEN
  5459.          D$ = D$ + STRING$(16 - L, 32)
  5460.            END IF
  5461.            D$ = D$ + "Number Of Times=" + STR$(N)
  5462.            DRWSTRING 1, 15, 8, D$, 0, 0
  5463.            SDELAY 80
  5464.         WEND
  5465.         MOUSEEXIT
  5466.         VIDEOMODESET VMODE
  5467.         END
  5468.  
  5469.  
  5470.  
  5471.  
  5472.  
  5473.  
  5474.  
  5475.  
  5476.  
  5477.  
  5478.  
  5479.  
  5480.  
  5481.  
  5482.  
  5483.  
  5484.  
  5485.  
  5486.  
  5487.  
  5488.  
  5489.  
  5490.  
  5491.  
  5492.  
  5493.  
  5494.  
  5495.  
  5496.  
  5497.  
  5498.  
  5499.  
  5500.  
  5501.  
  5502.  
  5503.  
  5504.  
  5505.  
  5506.  
  5507.  
  5508.                                      83
  5509.  
  5510.  
  5511.  
  5512.  
  5513.  
  5514.  
  5515.       MOUSECURSORDEFAULT
  5516.  
  5517.         PROTOTYPE
  5518.  
  5519.         SUB MOUSECURSORDEFAULT ()
  5520.  
  5521.         INPUT
  5522.  
  5523.         no input parameters
  5524.  
  5525.         OUTPUT
  5526.  
  5527.         no value returned
  5528.  
  5529.         USAGE
  5530.  
  5531.         MOUSECURSORDEFAULT defines the mouse cursor to be a small
  5532.         arrow with the hot spot in the upper, left corner.  This is
  5533.         the cursor set when MOUSEENTER is called.
  5534.  
  5535.         SEE ALSO
  5536.  
  5537.         MOUSECURSORSET, MOUSEENTER
  5538.  
  5539.         EXAMPLE
  5540.  
  5541.         See MOUSECURSORSET
  5542.  
  5543.  
  5544.  
  5545.  
  5546.  
  5547.  
  5548.  
  5549.  
  5550.  
  5551.  
  5552.  
  5553.  
  5554.  
  5555.  
  5556.  
  5557.  
  5558.  
  5559.  
  5560.  
  5561.  
  5562.  
  5563.  
  5564.  
  5565.  
  5566.  
  5567.  
  5568.  
  5569.  
  5570.  
  5571.                                      84
  5572.  
  5573.  
  5574.  
  5575.  
  5576.  
  5577.  
  5578.       MOUSECURSORSET
  5579.  
  5580.         PROTOTYPE
  5581.  
  5582.         SUB MOUSECURSORSET (MouseCursor$)
  5583.  
  5584.         INPUT
  5585.  
  5586.         MouseCursor$ - string * 386 containing mouse cursor data
  5587.  
  5588.         OUTPUT
  5589.  
  5590.         no value returned
  5591.  
  5592.         USAGE
  5593.  
  5594.         MOUSECURSORSET defines the cursor according to the data in
  5595.         MouseCursor$.  The hot spot X and Y location for the cursor is
  5596.         defined by the first two bytes of MouseCursor$.  The values
  5597.         for the hot spot must be within the cursor.  Valid values are
  5598.         from 0 to 15 for the X location and from 0 to 23 for the Y
  5599.         location.
  5600.  
  5601.         SEE ALSO
  5602.  
  5603.         MOUSECURSORDEFAULT, MOUSEENTER, MOUSESHOW
  5604.  
  5605.         EXAMPLE
  5606.  
  5607.         REM MAKE A BIG CURSOR, THEN RESTORE IT BACK TO THE DEFAULT
  5608.         REM $INCLUDE: 'SVGABC.BI'
  5609.         DEFINT A-Z
  5610.  
  5611.         VMODE = VIDEOMODEGET
  5612.         IF WHICHVGA = 0 THEN STOP
  5613.         IF WHICHMEM < 512 THEN STOP
  5614.         IF WHICHMOUSE = 0 THEN STOP
  5615.         DUMMY=RES640
  5616.         MOUSEENTER
  5617.         DIM BIGMOUSECURSOR AS STRING * 386
  5618.         FOR I = 1 TO 386
  5619.            READ A
  5620.            MID$(BIGMOUSECURSOR, I, 1) = CHR$(A)
  5621.         NEXT I
  5622.         MOUSECURSORSET BIGMOUSECURSOR
  5623.         MOUSERANGESET 0, 0, 639, 400
  5624.         MOUSESHOW
  5625.         A$ = "Press A Key To Return To The Default Cursor"
  5626.         DRWSTRING 1, 7, 0, A$, 0, 420
  5627.         WHILE INKEY$ = ""
  5628.         WEND
  5629.         MOUSECURSORDEFAULT
  5630.         A$ = "Press A Key To End                         "
  5631.         DRWSTRING 1, 7, 0, A$, 0, 420
  5632.  
  5633.  
  5634.                                      85
  5635.  
  5636.  
  5637.  
  5638.  
  5639.  
  5640.  
  5641.         WHILE INKEY$ = ""
  5642.         WEND
  5643.         MOUSEEXIT
  5644.         VIDEOMODESET VMODE
  5645.         END
  5646.  
  5647.         REM *BIG ARROW MOUSE CURSOR DATA
  5648.         DATA 2,2
  5649.         DATA 0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255
  5650.         DATA 0,15,15,0,0,255,255,255,255,255,255,255,255,255,255,255
  5651.         DATA 0,15,15,15,15,0,0,0,255,255,255,255,255,255,255,255
  5652.         DATA 0,15,15,15,15,15,15,15,0,0,255,255,255,255,255,255
  5653.         DATA 0,15,15,15,15,15,15,15,15,15,0,0,0,255,255,255
  5654.         DATA 0,15,15,15,15,15,15,15,15,15,15,15,15,0,0,255
  5655.         DATA 0,15,15,15,15,15,15,15,15,15,15,15,15,15,0,255
  5656.         DATA 0,15,15,15,15,15,15,15,15,15,15,15,0,0,255,255
  5657.         DATA 0,15,15,15,15,15,15,15,15,15,15,0,255,255,255,255
  5658.         DATA 0,15,15,15,15,15,15,15,15,0,0,255,255,255,255,255
  5659.         DATA 0,15,15,15,15,15,15,15,15,0,255,255,255,255,255,255
  5660.         DATA 0,15,15,15,15,15,0,15,15,15,0,255,255,255,255,255
  5661.         DATA 0,15,15,15,15,0,0,15,15,15,0,255,255,255,255,255
  5662.         DATA 0,15,15,0,0,255,255,0,15,15,15,0,255,255,255,255
  5663.         DATA 0,15,0,255,255,255,255,0,15,15,15,0,255,255,255,255
  5664.         DATA 0,0,255,255,255,255,255,255,0,15,15,15,0,255,255,255
  5665.         DATA 255,255,255,255,255,255,255,255,255,0,15,15,15,0,255,255
  5666.         DATA 255,255,255,255,255,255,255,255,255,0,15,15,15,0,255,255
  5667.         DATA 255,255,255,255,255,255,255,255,255,255,0,15,15,15,0,255
  5668.         DATA 255,255,255,255,255,255,255,255,255,255,255,0,15,15,15,0
  5669.         DATA 255,255,255,255,255,255,255,255,255,255,255,0,15,15,15,0
  5670.         DATA 255,255,255,255,255,255,255,255,255,255,255,255,0,15,15,0
  5671.         DATA 255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0
  5672.         DATA
  5673.         255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,25
  5674.         5
  5675.  
  5676.  
  5677.  
  5678.  
  5679.  
  5680.  
  5681.  
  5682.  
  5683.  
  5684.  
  5685.  
  5686.  
  5687.  
  5688.  
  5689.  
  5690.  
  5691.  
  5692.  
  5693.  
  5694.  
  5695.  
  5696.  
  5697.                                      86
  5698.  
  5699.  
  5700.  
  5701.  
  5702.  
  5703.  
  5704.       MOUSEENTER
  5705.  
  5706.         PROTOTYPE
  5707.  
  5708.         SUB MOUSEENTER ()
  5709.  
  5710.         INPUT
  5711.  
  5712.         no input parameters
  5713.  
  5714.         OUTPUT
  5715.  
  5716.         no value returned
  5717.  
  5718.         USAGE
  5719.  
  5720.         MOUSEENTER must be called before any other mouse functions.
  5721.         It initializes all of the mouse abilities including installing
  5722.         the Zephyr mouse display driver.  MOUSEENTER initializes the
  5723.         default mouse cursor, the default sensitivity and sets the
  5724.         range to the current screen resolution.  The mouse cursor
  5725.         location is set to the middle of the screen.
  5726.  
  5727.         SEE ALSO
  5728.  
  5729.         MOUSEEXIT, MOUSEHIDE, MOUSESHOW
  5730.  
  5731.         EXAMPLE
  5732.  
  5733.         REM ENABLE AND SHOW THE MOUSE
  5734.         REM $INCLUDE: 'SVGABC.BI'
  5735.         DEFINT A-Z
  5736.  
  5737.         VMODE = VIDEOMODEGET
  5738.         IF WHICHVGA = 0 THEN STOP
  5739.         IF WHICHMOUSE = 0 THEN STOP
  5740.         DUMMY=RES640
  5741.         MOUSEENTER
  5742.         MOUSESHOW
  5743.         WHILE INKEY$ = ""
  5744.         WEND
  5745.         MOUSEEXIT
  5746.         VIDEOMODESET VMODE
  5747.         END
  5748.  
  5749.  
  5750.  
  5751.  
  5752.  
  5753.  
  5754.  
  5755.  
  5756.  
  5757.  
  5758.  
  5759.  
  5760.                                      87
  5761.  
  5762.  
  5763.  
  5764.  
  5765.  
  5766.  
  5767.       MOUSEEXIT
  5768.  
  5769.         PROTOTYPE
  5770.  
  5771.         SUB MOUSEEXIT ()
  5772.  
  5773.         INPUT
  5774.  
  5775.         no input parameters
  5776.  
  5777.         OUTPUT
  5778.  
  5779.         no value returned
  5780.  
  5781.         USAGE
  5782.  
  5783.         MOUSEEXIT properly disables all of the mouse abilities.  This
  5784.         function also removes the Zephyr mouse display driver.  This
  5785.         function should be called prior to exiting any program that
  5786.         previously called MOUSEENTER.
  5787.  
  5788.         SEE ALSO
  5789.  
  5790.         MOUSEENTER, MOUSEHIDE, MOUSESHOW
  5791.  
  5792.         EXAMPLE
  5793.  
  5794.         See MOUSEENTER
  5795.  
  5796.  
  5797.  
  5798.  
  5799.  
  5800.  
  5801.  
  5802.  
  5803.  
  5804.  
  5805.  
  5806.  
  5807.  
  5808.  
  5809.  
  5810.  
  5811.  
  5812.  
  5813.  
  5814.  
  5815.  
  5816.  
  5817.  
  5818.  
  5819.  
  5820.  
  5821.  
  5822.  
  5823.                                      88
  5824.  
  5825.  
  5826.  
  5827.  
  5828.  
  5829.  
  5830.       MOUSEHIDE
  5831.  
  5832.         PROTOTYPE
  5833.  
  5834.         SUB MOUSEHIDE ()
  5835.  
  5836.         INPUT
  5837.  
  5838.         no input parameters
  5839.  
  5840.         OUTPUT
  5841.  
  5842.         no value returned
  5843.  
  5844.         USAGE
  5845.  
  5846.         MOUSEHIDE turns off the mouse display driver and removes the
  5847.         cursor from the display.  It is recommended to hide the mouse
  5848.         any time something will be drawn in its general vicinity.
  5849.         Note, however, that although the cursor is not visible, all
  5850.         other mouse abilities remain active.
  5851.  
  5852.         SEE ALSO
  5853.  
  5854.         MOUSEENTER, MOUSEEXIT, MOUSESHOW
  5855.  
  5856.         EXAMPLE
  5857.  
  5858.         REM ENABLE, SHOW, AND THE HIDE THE MOUSE
  5859.         REM $INCLUDE: 'SVGABC.BI'
  5860.         DEFINT A-Z
  5861.  
  5862.         VMODE = VIDEOMODEGET
  5863.         IF WHICHVGA = 0 THEN STOP
  5864.         IF WHICHMOUSE = 0 THEN STOP
  5865.         DUMMY=RES640
  5866.  
  5867.         MOUSEENTER
  5868.         MOUSESHOW
  5869.         WHILE INKEY$ = ""
  5870.         WEND
  5871.         MOUSEHIDE
  5872.  
  5873.         WHILE INKEY$ = ""
  5874.         WEND
  5875.         MOUSEEXIT
  5876.         VIDEOMODESET VMODE
  5877.  
  5878.         END
  5879.  
  5880.  
  5881.  
  5882.  
  5883.  
  5884.  
  5885.  
  5886.                                      89
  5887.  
  5888.  
  5889.  
  5890.  
  5891.  
  5892.  
  5893.       MOUSEINFO
  5894.  
  5895.         PROTOTYPE
  5896.  
  5897.         SUB MOUSEINFO (MajorVersion%, MinorVersion%, MouseType%, IRQ%)
  5898.  
  5899.         INPUT
  5900.  
  5901.         no input parameters
  5902.  
  5903.         OUTPUT
  5904.  
  5905.         no value returned
  5906.         MajorVersion - Microsoft compatible mouse driver major version
  5907.         number
  5908.         MinorVersion - Microsoft compatible mouse driver minor version
  5909.         number
  5910.         MouseType - type of mouse installed
  5911.         IRQ - the interrupt used by the mouse
  5912.  
  5913.         USAGE
  5914.  
  5915.         MOUSEINFO returns information about the mouse and its
  5916.         installed driver.  The driver must be Microsoft compatible.
  5917.         This information can be used to determine whether the mouse
  5918.         functions in this library will operate correctly.  For proper
  5919.         operation the driver version number must be greater than 1.00.
  5920.         IRQ gives the interrupt number of the mouse - probably 3 or 4.
  5921.         MouseType returns information about the type of hardware
  5922.         installed according to the following table:
  5923.  
  5924.         0 =  unknown type
  5925.         1 =  bus mouse
  5926.         2 =  serial mouse
  5927.         3 =  Inport mouse
  5928.         4 =  PS/2 mouse
  5929.         5 =  HP mouse
  5930.  
  5931.         SEE ALSO
  5932.  
  5933.         WHICHMOUSE
  5934.  
  5935.         EXAMPLE
  5936.  
  5937.         REM RETURN INFORMATION ABOUT THE MOUSE
  5938.         REM $INCLUDE: 'SVGABC.BI'
  5939.         DEFINT A-Z
  5940.  
  5941.         CLS
  5942.         MOUSE = WHICHMOUSE
  5943.         IF MOUSE > 0 THEN
  5944.            MOUSEINFO MJV, MNV, TP, I
  5945.            VER$ = STR$(MNV)
  5946.            L = LEN(VER$)
  5947.  
  5948.  
  5949.                                      90
  5950.  
  5951.  
  5952.  
  5953.  
  5954.  
  5955.  
  5956.            VER$ = STR$(MJV) + "." + RIGHT$(VER$, L - 1)
  5957.            VER$ = "Software driver version is" + VER$
  5958.            VER$ = VER$ + " (Microsoft equivalent version)."
  5959.            SELECT CASE TP
  5960.          CASE IS = 1
  5961.             TYPE$ = "bus mouse"
  5962.          CASE IS = 2
  5963.             TYPE$ = "serial mouse"
  5964.          CASE IS = 3
  5965.             TYPE$ = "Inport mouse"
  5966.          CASE IS = 4
  5967.             TYPE$ = "PS/2 mouse"
  5968.          CASE IS = 5
  5969.             TYPE$ = "HP mouse"
  5970.          CASE ELSE
  5971.             TYPE$ = "unknown type"
  5972.            END SELECT
  5973.            PRINT "Microsoft compatible " + TYPE$ + " detected with";
  5974.            PRINT STR$(MOUSE) + " buttons on IRQ" + STR$(I) + "."
  5975.            PRINT VER$
  5976.         ELSE
  5977.            PRINT "No Microsoft compatible mouse detected."
  5978.         END IF
  5979.         PRINT
  5980.         WHILE INKEY$ = ""
  5981.         WEND
  5982.         END
  5983.  
  5984.  
  5985.  
  5986.  
  5987.  
  5988.  
  5989.  
  5990.  
  5991.  
  5992.  
  5993.  
  5994.  
  5995.  
  5996.  
  5997.  
  5998.  
  5999.  
  6000.  
  6001.  
  6002.  
  6003.  
  6004.  
  6005.  
  6006.  
  6007.  
  6008.  
  6009.  
  6010.  
  6011.  
  6012.                                      91
  6013.  
  6014.  
  6015.  
  6016.  
  6017.  
  6018.  
  6019.       MOUSELOCSET
  6020.  
  6021.         PROTOTYPE
  6022.  
  6023.         SUB MOUSELOCSET (X%, Y%)
  6024.  
  6025.         INPUT
  6026.  
  6027.         X, Y - location on screen
  6028.  
  6029.         OUTPUT
  6030.  
  6031.         no value returned
  6032.  
  6033.         USAGE
  6034.  
  6035.         MOUSELOCSET moves the mouse cursor the location on the screen
  6036.         specified by X, Y.  If either X or Y is outside of the
  6037.         currently permitted mouse range, it is set to the closest
  6038.         border.  The currently permitted mouse range is the current
  6039.         screen resolution or the last called MOUSERANGESET.
  6040.  
  6041.         SEE ALSO
  6042.  
  6043.         MOUSEENTER, MOUSERANGESET
  6044.  
  6045.         EXAMPLE
  6046.  
  6047.         REM ENABLE AND SHOW THE MOUSE THEN MOVE IT TO THE ORIGIN
  6048.         REM $INCLUDE: 'SVGABC.BI'
  6049.         DEFINT A-Z
  6050.  
  6051.         VMODE = VIDEOMODEGET
  6052.         IF WHICHVGA = 0 THEN STOP
  6053.         IF WHICHMOUSE = 0 THEN STOP
  6054.         DUMMY=RES640
  6055.         MOUSEENTER
  6056.         MOUSESHOW
  6057.         WHILE INKEY$ = ""
  6058.         WEND
  6059.         MOUSELOCSET 0, 0
  6060.         WHILE INKEY$ = ""
  6061.         WEND
  6062.         MOUSEEXIT
  6063.         VIDEOMODESET VMODE
  6064.         END
  6065.  
  6066.  
  6067.  
  6068.  
  6069.  
  6070.  
  6071.  
  6072.  
  6073.  
  6074.  
  6075.                                      92
  6076.  
  6077.  
  6078.  
  6079.  
  6080.  
  6081.  
  6082.       MOUSERANGESET
  6083.  
  6084.         PROTOTYPE
  6085.  
  6086.         SUB MOUSERANGESET (X1%, Y1%, X2%, Y2%)
  6087.  
  6088.         INPUT
  6089.  
  6090.         X1, Y1 - location on screen of top, left corner of range
  6091.         X2, Y2 - location on screen of bottom, right corner of range
  6092.  
  6093.         OUTPUT
  6094.  
  6095.         no value returned
  6096.  
  6097.         USAGE
  6098.  
  6099.         MOUSERANGESET defines a permissible range on the screen for
  6100.         mouse movement.  The mouse is automatically positioned in the
  6101.         center of this range.
  6102.  
  6103.         SEE ALSO
  6104.  
  6105.         MOUSELOCSET, MOUSESTATUS
  6106.  
  6107.         EXAMPLE
  6108.  
  6109.         REM ENABLE, SHOW, AND SET A RANGE FOR THE MOUSE
  6110.         REM $INCLUDE: 'SVGABC.BI'
  6111.         DEFINT A-Z
  6112.  
  6113.         VMODE = VIDEOMODEGET
  6114.         IF WHICHVGA = 0 THEN STOP
  6115.         IF WHICHMOUSE = 0 THEN STOP
  6116.         DUMMY=RES640
  6117.         MOUSEENTER
  6118.         DRWBOX 1, 10, 100, 100, 539, 379
  6119.         MOUSERANGESET 100, 100, 539, 379
  6120.         MOUSESHOW
  6121.         WHILE INKEY$ = ""
  6122.         WEND
  6123.         MOUSEEXIT
  6124.         VIDEOMODESET VMODE
  6125.         END
  6126.  
  6127.  
  6128.  
  6129.  
  6130.  
  6131.  
  6132.  
  6133.  
  6134.  
  6135.  
  6136.  
  6137.  
  6138.                                      93
  6139.  
  6140.  
  6141.  
  6142.  
  6143.  
  6144.  
  6145.       MOUSERESTORESTATE
  6146.  
  6147.         PROTOTYPE
  6148.  
  6149.         SUB MOUSERESTORESTATE (MouseBuf%)
  6150.  
  6151.         INPUT
  6152.  
  6153.         MouseBuf - integer array holding complete mouse status
  6154.         information
  6155.  
  6156.         OUTPUT
  6157.  
  6158.         no value returned
  6159.  
  6160.         USAGE
  6161.  
  6162.         MOUSERESTORESTATE completely restores a previously saved mouse
  6163.         status as contained in MouseBuf.  The mouse status must have
  6164.         been already stored in MouseBuf by MOUSESAVESTATE.
  6165.  
  6166.         SEE ALSO
  6167.  
  6168.         MOUSESAVESTATE, MOUSESTORAGESIZE
  6169.  
  6170.         EXAMPLE
  6171.  
  6172.         REM SAVE THE CURRENT MOUSE DRIVER STATUS,SHELL OUT, RESTORE IT
  6173.         REM $INCLUDE: 'SVGABC.BI'
  6174.         DEFINT A-Z
  6175.  
  6176.         IF WHICHMOUSE = 0 THEN STOP
  6177.         BUFSIZE = MOUSESTORAGESIZE \ 2 + 1
  6178.         DIM MBUFFER(0 TO BUFSIZE) AS INTEGER
  6179.         MOUSESAVESTATE MBUFFER(0)
  6180.         PRINT "TYPE 'EXIT' TO RETURN TO THE PROGRAM"
  6181.         SHELL
  6182.         CLS
  6183.         MOUSERESTORESTATE MBUFFER(0)
  6184.         PRINT "DRIVER RESTORED..."
  6185.         WHILE INKEY$ = ""
  6186.         WEND
  6187.         END
  6188.  
  6189.  
  6190.  
  6191.  
  6192.  
  6193.  
  6194.  
  6195.  
  6196.  
  6197.  
  6198.  
  6199.  
  6200.  
  6201.                                      94
  6202.  
  6203.  
  6204.  
  6205.  
  6206.  
  6207.  
  6208.       MOUSESAVESTATE
  6209.  
  6210.         PROTOTYPE
  6211.  
  6212.         SUB MOUSESAVESTATE (MouseBuf%)
  6213.  
  6214.         INPUT
  6215.  
  6216.         no input parameters
  6217.  
  6218.         OUTPUT
  6219.  
  6220.         no value returned
  6221.         MouseBuf - integer array holding complete mouse status
  6222.         information
  6223.  
  6224.         USAGE
  6225.  
  6226.         MOUSESAVESTATE saves the complete mouse status in MouseBuf.
  6227.         The size of MouseBuf in bytes is defined by MOUSESTORAGESIZE
  6228.         which should called first.
  6229.  
  6230.         SEE ALSO
  6231.  
  6232.         MOUSERESTORESTATE, MOUSESTORAGESIZE
  6233.  
  6234.         EXAMPLE
  6235.  
  6236.         See MOUSERESTORESTATE
  6237.  
  6238.  
  6239.  
  6240.  
  6241.  
  6242.  
  6243.  
  6244.  
  6245.  
  6246.  
  6247.  
  6248.  
  6249.  
  6250.  
  6251.  
  6252.  
  6253.  
  6254.  
  6255.  
  6256.  
  6257.  
  6258.  
  6259.  
  6260.  
  6261.  
  6262.  
  6263.  
  6264.                                      95
  6265.  
  6266.  
  6267.  
  6268.  
  6269.  
  6270.  
  6271.       MOUSESENSSET
  6272.  
  6273.         PROTOTYPE
  6274.  
  6275.         SUB MOUSESENSSET (XSens%, Ysens%, DblSpdTresh%)
  6276.  
  6277.         INPUT
  6278.  
  6279.         XSens - number of mickeys per 8 pixels horizontally (default =
  6280.         8 mickeys per 8 pixels)
  6281.         YSens - number of mickeys per 8 pixels vertically (default =
  6282.         16 mickeys per 8 pixels)
  6283.         DblSpdThresh = number of mickeys per second at which speed is
  6284.         doubled (default = 64)
  6285.  
  6286.         OUTPUT
  6287.  
  6288.         no value returned
  6289.  
  6290.         USAGE
  6291.  
  6292.         MOUSESENSSET defines the relationship between mouse movement
  6293.         and cursor movement on the screen.  A mickey is defined as
  6294.         1/200th of an inch.  The ratio between mickeys and pixels is
  6295.         specified by XSens and YSens in the horizontal and vertical
  6296.         directions respectively.  When the mouse movement is faster
  6297.         than DblSpdThresh in mickeys per second, the speed is doubled.
  6298.         The default values are assigned whenever MOUSEENTER or
  6299.         MOUSEEXIT are called.
  6300.  
  6301.         SEE ALSO
  6302.  
  6303.         MOUSEENTER, MOUSEEXIT, MOUSESTATUS
  6304.  
  6305.         EXAMPLE
  6306.  
  6307.         REM ENABLE, SHOW THE MOUSE AND MAKE IT VERY SENSITIVE
  6308.         REM $INCLUDE: 'SVGABC.BI'
  6309.         DEFINT A-Z
  6310.  
  6311.         VMODE = VIDEOMODEGET
  6312.         IF WHICHVGA = 0 THEN STOP
  6313.         IF WHICHMOUSE = 0 THEN STOP
  6314.         DUMMY=RES640
  6315.         MOUSEENTER
  6316.         MOUSESHOW
  6317.         MOUSESENSSET 50, 50, 10
  6318.         WHILE INKEY$ = ""
  6319.         WEND
  6320.         MOUSEEXIT
  6321.         VIDEOMODESET VMODE
  6322.         END
  6323.  
  6324.  
  6325.  
  6326.  
  6327.                                      96
  6328.  
  6329.  
  6330.  
  6331.  
  6332.  
  6333.  
  6334.       MOUSESHOW
  6335.  
  6336.         PROTOTYPE
  6337.  
  6338.         SUB MOUSESHOW ()
  6339.  
  6340.         INPUT
  6341.  
  6342.         no input parameters
  6343.  
  6344.         OUTPUT
  6345.  
  6346.         no value returned
  6347.  
  6348.         USAGE
  6349.  
  6350.         MOUSESHOW enables the mouse display driver and places the
  6351.         cursor on the screen.  The cursor is only updated when the
  6352.         mouse is moved.  Therefore, it is recommended to hide the
  6353.         cursor when drawing on the screen to avoid unexpected results.
  6354.  
  6355.         SEE ALSO
  6356.  
  6357.         MOUSEENTER, MOUSEEXIT, MOUSEHIDE
  6358.  
  6359.         EXAMPLE
  6360.  
  6361.         See MOUSEHIDE
  6362.  
  6363.  
  6364.  
  6365.  
  6366.  
  6367.  
  6368.  
  6369.  
  6370.  
  6371.  
  6372.  
  6373.  
  6374.  
  6375.  
  6376.  
  6377.  
  6378.  
  6379.  
  6380.  
  6381.  
  6382.  
  6383.  
  6384.  
  6385.  
  6386.  
  6387.  
  6388.  
  6389.  
  6390.                                      97
  6391.  
  6392.  
  6393.  
  6394.  
  6395.  
  6396.  
  6397.       MOUSESTATUS
  6398.  
  6399.         PROTOTYPE
  6400.  
  6401.         SUB MOUSESTATUS (X%, Y%, MouseButs%)
  6402.  
  6403.         INPUT
  6404.  
  6405.         no input parameters
  6406.  
  6407.         OUTPUT
  6408.  
  6409.         no value returned
  6410.         X, Y - mouse position on screen
  6411.         MouseButs - status of mouse buttons
  6412.  
  6413.         USAGE
  6414.  
  6415.         MOUSESTATUS returns the current status of the mouse position
  6416.         and buttons.  The position is returned in X, Y.  The buttons'
  6417.         status is held in MouseButs.  The left button is held in bit
  6418.         zero, right button in bit one and center button - for three
  6419.         button mice - in bit two.  Button status is most easily
  6420.         checked with a bitwise AND of MouseButs and the desired bit.
  6421.  
  6422.         SEE ALSO
  6423.  
  6424.         MOUSERANGESET, MOUSESENSSET
  6425.  
  6426.         EXAMPLE
  6427.  
  6428.         REM ENABLE, SHOW, DISPLAY MOUSE STATUS
  6429.         REM $INCLUDE: 'SVGABC.BI'
  6430.         DEFINT A-Z
  6431.         VMODE = VIDEOMODEGET
  6432.         IF WHICHVGA = 0 THEN STOP
  6433.         IF WHICHMOUSE = 0 THEN STOP
  6434.         DUMMY=RES640
  6435.         MOUSEENTER
  6436.         MOUSESHOW
  6437.         WHILE INKEY$ = ""
  6438.            MOUSESTATUS X, Y, MButs
  6439.            D$ = "MX=" + STR$(X)
  6440.            L = LEN(D$)
  6441.            IF L < 10 THEN
  6442.          D$ = D$ + STRING$(8 - L, 32)
  6443.            END IF
  6444.            D$ = D$ + "MY=" + STR$(Y)
  6445.            L = LEN(D$)
  6446.            IF L < 20 THEN
  6447.          D$ = D$ + STRING$(16 - L, 32)
  6448.            END IF
  6449.            D$ = D$ + "MBUTS=" + STR$(MButs)
  6450.            DRWSTRING 1, 15, 8, D$, 0, 0
  6451.  
  6452.  
  6453.                                      98
  6454.  
  6455.  
  6456.  
  6457.  
  6458.  
  6459.  
  6460.         WEND
  6461.         MOUSEEXIT
  6462.         VIDEOMODESET VMODE
  6463.         END
  6464.  
  6465.  
  6466.  
  6467.  
  6468.  
  6469.  
  6470.  
  6471.  
  6472.  
  6473.  
  6474.  
  6475.  
  6476.  
  6477.  
  6478.  
  6479.  
  6480.  
  6481.  
  6482.  
  6483.  
  6484.  
  6485.  
  6486.  
  6487.  
  6488.  
  6489.  
  6490.  
  6491.  
  6492.  
  6493.  
  6494.  
  6495.  
  6496.  
  6497.  
  6498.  
  6499.  
  6500.  
  6501.  
  6502.  
  6503.  
  6504.  
  6505.  
  6506.  
  6507.  
  6508.  
  6509.  
  6510.  
  6511.  
  6512.  
  6513.  
  6514.  
  6515.  
  6516.                                      99
  6517.  
  6518.  
  6519.  
  6520.  
  6521.  
  6522.  
  6523.       MOUSESTORAGESIZE
  6524.  
  6525.         PROTOTYPE
  6526.  
  6527.         FUNCTION MOUSESTORAGESIZE% ()
  6528.  
  6529.         INPUT
  6530.  
  6531.         no input parameters
  6532.  
  6533.         OUTPUT
  6534.  
  6535.         MOUSESTORAGESIZE returns the number of bytes needed to store
  6536.         the complete mouse status.
  6537.  
  6538.         USAGE
  6539.  
  6540.         MOUSESTORAGESIZE determines the proper size buffer to hold the
  6541.         complete mouse status information.  This buffer should be
  6542.         created before calling MOUSESAVESTATE.
  6543.  
  6544.         SEE ALSO
  6545.  
  6546.         MOUSERESTORESTATE, MOUSESAVESTATE
  6547.  
  6548.         EXAMPLE
  6549.  
  6550.         REM RETURN THE SIZE IN BYTES NEEDED TO SAVE THE MOUSE STATUS
  6551.         REM $INCLUDE: 'SVGABC.BI'
  6552.         DEFINT A-Z
  6553.  
  6554.         CLS
  6555.         IF WHICHMOUSE = 0 THEN STOP
  6556.         A$ = "The Mouse Driver Requires A" + STR$(MOUSESTORAGESIZE) +
  6557.         " Byte Buffer "
  6558.         A$ = A$ + "To Save Current Status."
  6559.         PRINT A$
  6560.         PRINT
  6561.         WHILE INKEY$ = ""
  6562.         WEND
  6563.         END
  6564.  
  6565.  
  6566.  
  6567.  
  6568.  
  6569.  
  6570.  
  6571.  
  6572.  
  6573.  
  6574.  
  6575.  
  6576.  
  6577.  
  6578.  
  6579.                                     100
  6580.  
  6581.  
  6582.  
  6583.  
  6584.  
  6585.  
  6586.       OVERSCANSET
  6587.  
  6588.         PROTOTYPE
  6589.  
  6590.         SUB OVERSCANSET (Color%)
  6591.  
  6592.         INPUT
  6593.  
  6594.         Color - index to color in current palette
  6595.  
  6596.         OUTPUT
  6597.  
  6598.         no value returned
  6599.  
  6600.         USAGE
  6601.  
  6602.         OVERSCANSET sets the overscan region to the specified color.
  6603.         The overscan region is the area between the usable pixel area
  6604.         and the region not scanned by the monitor.  Normally, the
  6605.         overscan is color zero which is defined as black the majority
  6606.         of the time.  The overscan color is reset to zero anytime a
  6607.         RES### function is called.
  6608.  
  6609.         Note: OVERSCANSET always works in the 320x200 resolution.  In
  6610.         the higher resolutions on many common SVGA cards this function
  6611.         is ignored.  Instead, the card always assigns the overscan
  6612.         region to color zero.  Therefore, it is recommended to not use
  6613.         OVERSCANSET, but assign color zero as needed.
  6614.  
  6615.         EXAMPLE
  6616.  
  6617.         REM SET THE OVERSCAN COLOR TO GREEN
  6618.         REM $INCLUDE: 'SVGABC.BI'
  6619.         DEFINT A-Z
  6620.         VMODE = VIDEOMODEGET
  6621.         IF WHICHVGA = 0 THEN STOP
  6622.         RES320
  6623.         OVERSCANSET 10
  6624.         WHILE INKEY$ = ""
  6625.         WEND
  6626.         VIDEOMODESET VMODE
  6627.         END
  6628.  
  6629.  
  6630.  
  6631.  
  6632.  
  6633.  
  6634.  
  6635.  
  6636.  
  6637.  
  6638.  
  6639.  
  6640.  
  6641.  
  6642.                                     101
  6643.  
  6644.  
  6645.  
  6646.  
  6647.  
  6648.  
  6649.       PAGEACTIVE
  6650.  
  6651.         PROTOTYPE
  6652.  
  6653.         FUNCTION PAGEACTIVE (Page%)
  6654.  
  6655.         INPUT
  6656.  
  6657.         Page - number of page to make active
  6658.  
  6659.         OUTPUT
  6660.  
  6661.         PAGEACTIVE returns a 1 if successful, 0 if unsuccessful.
  6662.  
  6663.         USAGE
  6664.  
  6665.         PAGEACTIVE sets the active page as specified by Page.  It
  6666.         works by creating an offset to be added when any bank
  6667.         switching is performed.  This function does not affect the
  6668.         actual display.  A page is defined as the number of 64K blocks
  6669.         necessary to contain the current screen resolution.  For
  6670.         example, 640x480 requires 307,200 bytes which is a little more
  6671.         than 4.5 64K blocks.  One page in this resolution will be 5
  6672.         banks.
  6673.  
  6674.         PAGEACTIVE does not work in 320x200 mode since this mode uses
  6675.         no bank switching.
  6676.  
  6677.         SEE ALSO
  6678.  
  6679.         PAGEDISPLAY
  6680.  
  6681.         EXAMPLE
  6682.  
  6683.         REM SHOW PAGEACTIVE FUNCTION
  6684.         REM THIS EXAMPLE REQUIRES 1 MEG OF VIDEO MEMORY
  6685.         REM $INCLUDE: 'SVGABC.BI'
  6686.         DEFINT A-Z
  6687.  
  6688.         IF WHICHVGA = 0 THEN
  6689.            END
  6690.         END IF
  6691.         IF WHICHMEM < 1024 THEN
  6692.            END
  6693.         END IF
  6694.         IF RES640 = 0 THEN
  6695.            END
  6696.         END IF
  6697.  
  6698.         REM MAKE SURE VIDEO CARD SUPPORTS PAGE FLIPPING
  6699.         IF PAGEDISPLAY(0, 0, 0) = 0 THEN
  6700.            DUMMY = RESTEXT
  6701.         END
  6702.         END IF
  6703.  
  6704.  
  6705.                                     102
  6706.  
  6707.  
  6708.  
  6709.  
  6710.  
  6711.  
  6712.         DUMMY = PAGEACTIVE(0)
  6713.         FILLPAGE 0
  6714.         DRWSTRING 1, 10, 0, "PAGE 0", 0, 0
  6715.         DRWSTRING 1, 10, 0, "PRESS A KEY...", 0, 300
  6716.         DUMMY = PAGEACTIVE(1)
  6717.         FILLPAGE 0
  6718.         DRWSTRING 1, 12, 0, "PAGE 1", 0, 20
  6719.         DRWSTRING 1, 12, 0, "PRESS A KEY...", 0, 300
  6720.         DUMMY = PAGEACTIVE(2)
  6721.         FILLPAGE 0
  6722.         DRWSTRING 1, 13, 0, "PAGE 2", 0, 40
  6723.         DRWSTRING 1, 13, 0, "PRESS A KEY...", 0, 300
  6724.         DUMMY = PAGEDISPLAY(0, 0, 0)
  6725.         WHILE INKEY$ = ""
  6726.         WEND
  6727.         DUMMY = PAGEDISPLAY(0, 0, 1)
  6728.         WHILE INKEY$ = ""
  6729.         WEND
  6730.         DUMMY = PAGEDISPLAY(0, 0, 2)
  6731.         WHILE INKEY$ = ""
  6732.         WEND
  6733.         DUMMY = RESTEXT
  6734.         CLS
  6735.         END
  6736.  
  6737.  
  6738.  
  6739.  
  6740.  
  6741.  
  6742.  
  6743.  
  6744.  
  6745.  
  6746.  
  6747.  
  6748.  
  6749.  
  6750.  
  6751.  
  6752.  
  6753.  
  6754.  
  6755.  
  6756.  
  6757.  
  6758.  
  6759.  
  6760.  
  6761.  
  6762.  
  6763.  
  6764.  
  6765.  
  6766.  
  6767.  
  6768.                                     103
  6769.  
  6770.  
  6771.  
  6772.  
  6773.  
  6774.  
  6775.       PAGEDISPLAY
  6776.  
  6777.         PROTOTYPE
  6778.  
  6779.         FUNCTION PAGEDISPLAY (X%, Y%, Page%)
  6780.  
  6781.         INPUT
  6782.  
  6783.         X, Y - coordinate to place at top, left of display
  6784.         Page - number of page to make active
  6785.  
  6786.         OUTPUT
  6787.  
  6788.         PAGEACTIVE returns a 1 if successful, 0 if unsuccessful.
  6789.  
  6790.         USAGE
  6791.  
  6792.         PAGEDISPLAY tells the video card where in video memory to
  6793.         begin the display.  This display offset is calculated from the
  6794.         specified Page, X and Y.  This is done by multiplying Y times
  6795.         the width of the current resolution, adding X and then adding
  6796.         the appropriate number of 64K blocks for Page.  X, Y and Page
  6797.         must all be positive numbers, but are otherwise not
  6798.         restricted.  The display will wrap if the values are
  6799.         abnormally large.  Wrapping will happen from side to side as
  6800.         well as from top of memory to bottom of memory.
  6801.  
  6802.         PAGEDISPLAY does not work in 320x200 mode since this mode uses
  6803.         no bank switching.  In addition, older models of some SVGA
  6804.         cards operating in native mode do not support paging.  In this
  6805.         library these cards are: Acumos, Ahead version A, Everex and
  6806.         Genoa.  To ensure compatibility, a program should make a call
  6807.         similar to:
  6808.  
  6809.         RET = PAGEDISPLAY(0,0,0)
  6810.         IF RET = 0 THEN PRINT "PAGING NOT SUPPORTED"
  6811.  
  6812.         Note: SVGA cards by ATI Technologies appear to ignore bit 4
  6813.         (counting from 0 to 19) in its linear addressing mode and
  6814.         assume it is zero.  Therefore, bit 4 of the x parameter will
  6815.         be ignored by ATI chipsets.
  6816.  
  6817.         SEE ALSO
  6818.  
  6819.         PAGEACTIVE
  6820.  
  6821.         EXAMPLE
  6822.  
  6823.         See PAGEACTIVE
  6824.  
  6825.  
  6826.  
  6827.  
  6828.  
  6829.  
  6830.  
  6831.                                     104
  6832.  
  6833.  
  6834.  
  6835.  
  6836.  
  6837.  
  6838.       PALCHGAUTO
  6839.  
  6840.         PROTOTYPE
  6841.  
  6842.         SUB PALCHGAUTO (Pal$, NewPal$, FirstColor%, LastColor%,
  6843.         Speed%)
  6844.  
  6845.         INPUT
  6846.  
  6847.         Pal$ - string * 768 containing initial palette
  6848.         NewPal$ - string *768 containing new palette
  6849.         FirstColor - index into palette where change will begin
  6850.         LastColor - index into palette where change will end
  6851.         Speed - speed of change
  6852.  
  6853.         OUTPUT
  6854.  
  6855.         no value returned
  6856.  
  6857.         USAGE
  6858.  
  6859.         PALCHGAUTO smoothly fades the colors between FirstColor and
  6860.         LastColor from the palette Pal$ to NewPal$.  The speed of the
  6861.         fade is set by Speed which is percentage change between each
  6862.         step of the fade.  Only values between 1 and 128 are valid
  6863.         where 1 represents a one percent change between steps and 128
  6864.         (80 hex) represents fifty percent change between steps.  A
  6865.         Speed of 128 would then have only two steps.  A Speed outside
  6866.         of the valid range causes the function to immediately return
  6867.         without making any changes.  The time required to accomplish
  6868.         the entire fade is approximately equal to 0.033 seconds times
  6869.         256 divided by Speed.  PALCHGAUTO does not modify either Pal$
  6870.         or NewPal$.
  6871.  
  6872.         SEE ALSO
  6873.  
  6874.         PALCHGSTEP, PALDIMSTEP, PALIOAUTO
  6875.  
  6876.         EXAMPLE
  6877.  
  6878.         REM AUTOFADE FROM ONE PALETTE TO ANOTHER AND BACK AGAIN
  6879.         REM $INCLUDE: 'SVGABC.BI'
  6880.         DEFINT A-Z
  6881.         DIM PAL AS STRING * 768
  6882.         DIM NEWPAL AS STRING * 768
  6883.  
  6884.         VMODE = VIDEOMODEGET
  6885.         IF WHICHVGA = 0 THEN STOP
  6886.         IF WHICHMEM < 512 THEN STOP
  6887.         DUMMY=RES640
  6888.         PALGET PAL, 0, 255
  6889.         FOR I = 1 TO 768
  6890.            MID$(NEWPAL, I, 1) = MID$(PAL, 769 - I, 1)
  6891.         NEXT I
  6892.  
  6893.  
  6894.                                     105
  6895.  
  6896.  
  6897.  
  6898.  
  6899.  
  6900.  
  6901.         COLR = 0
  6902.         FOR I = 0 TO 639
  6903.            DRWLINE 1, COLR, I, 0, I, 479
  6904.            COLR = COLR + 1
  6905.            IF COLR > 255 THEN
  6906.          COLR = 0
  6907.            END IF
  6908.         NEXT I
  6909.         PALCHGAUTO PAL, NEWPAL, 0, 255, 2
  6910.         PALCHGAUTO NEWPAL, PAL, 0, 255, 2
  6911.         WHILE INKEY$ = ""
  6912.         WEND
  6913.         VIDEOMODESET VMODE
  6914.         END
  6915.  
  6916.  
  6917.  
  6918.  
  6919.  
  6920.  
  6921.  
  6922.  
  6923.  
  6924.  
  6925.  
  6926.  
  6927.  
  6928.  
  6929.  
  6930.  
  6931.  
  6932.  
  6933.  
  6934.  
  6935.  
  6936.  
  6937.  
  6938.  
  6939.  
  6940.  
  6941.  
  6942.  
  6943.  
  6944.  
  6945.  
  6946.  
  6947.  
  6948.  
  6949.  
  6950.  
  6951.  
  6952.  
  6953.  
  6954.  
  6955.  
  6956.  
  6957.                                     106
  6958.  
  6959.  
  6960.  
  6961.  
  6962.  
  6963.  
  6964.       PALCHGSTEP
  6965.  
  6966.         PROTOTYPE
  6967.  
  6968.         SUB PALCHGSTEP (Pal$, NewPal$, FirstColor%, LastColor%,
  6969.         Percent%)
  6970.  
  6971.         INPUT
  6972.  
  6973.         Pal$ - string * 768 containing initial palette
  6974.         NewPal$ - string * 768 containing new palette
  6975.         FirstColor - index into palette where change will begin
  6976.         LastColor - index into palette where change will end
  6977.         Percent - percent step from current palette to new palette
  6978.  
  6979.         OUTPUT
  6980.  
  6981.         no value returned
  6982.  
  6983.         USAGE
  6984.  
  6985.         PALCHGSTEP changes the palette colors between FirstColor and
  6986.         LastColor by Percent from Pal$ to NewPal$.  This function
  6987.         works very much like PALCHGAUTO except it only takes a single
  6988.         step and returns.  The step taken is a percentage specified by
  6989.         Percent where 256 (100 hex) is a 100 percent change.  The
  6990.         valid range for Percent is 0 to 256.  Values beyond this range
  6991.         cause the function to immediately return without making any
  6992.         changes.  A loop from 4 to 256 by fours using PALCHGSTEP would
  6993.         have similar results as PALCHGAUTO with a speed of 4.  Neither
  6994.         Pal$, nor NewPal$ are modified.
  6995.  
  6996.         SEE ALSO
  6997.  
  6998.         PALCHGAUTO, PALDIMSTEP, PALIOAUTO
  6999.  
  7000.         EXAMPLE
  7001.  
  7002.         REM STEP FADE FROM ONE PALETTE TO ANOTHER AND BACK AGAIN FAST
  7003.         REM $INCLUDE: 'SVGABC.BI'
  7004.         DEFINT A-Z
  7005.         DIM PAL AS STRING * 768
  7006.         DIM NEWPAL AS STRING * 768
  7007.  
  7008.         VMODE = VIDEOMODEGET
  7009.         IF WHICHVGA = 0 THEN STOP
  7010.         IF WHICHMEM < 512 THEN STOP
  7011.         DUMMY=RES640
  7012.         PALGET PAL, 0, 255
  7013.         FOR I = 1 TO 768
  7014.            MID$(NEWPAL, I, 1) = MID$(PAL, 769 - I, 1)
  7015.         NEXT I
  7016.         COLR = 0
  7017.         FOR I = 0 TO 639
  7018.  
  7019.  
  7020.                                     107
  7021.  
  7022.  
  7023.  
  7024.  
  7025.  
  7026.  
  7027.            DRWLINE 1, COLR, I, 0, I, 479
  7028.            COLR = COLR + 1
  7029.            IF COLR > 255 THEN
  7030.          COLR = 0
  7031.            END IF
  7032.         NEXT I
  7033.         FOR I = 1 TO 255 STEP 2
  7034.            PALCHGSTEP PAL, NEWPAL, 0, 255, I
  7035.         NEXT I
  7036.         FOR I = 1 TO 255 STEP 16
  7037.            PALCHGSTEP NEWPAL, PAL, 0, 255, I
  7038.         NEXT I
  7039.         WHILE INKEY$ = ""
  7040.         WEND
  7041.         VIDEOMODESET VMODE
  7042.         END
  7043.  
  7044.  
  7045.  
  7046.  
  7047.  
  7048.  
  7049.  
  7050.  
  7051.  
  7052.  
  7053.  
  7054.  
  7055.  
  7056.  
  7057.  
  7058.  
  7059.  
  7060.  
  7061.  
  7062.  
  7063.  
  7064.  
  7065.  
  7066.  
  7067.  
  7068.  
  7069.  
  7070.  
  7071.  
  7072.  
  7073.  
  7074.  
  7075.  
  7076.  
  7077.  
  7078.  
  7079.  
  7080.  
  7081.  
  7082.  
  7083.                                     108
  7084.  
  7085.  
  7086.  
  7087.  
  7088.  
  7089.  
  7090.       PALCOPY
  7091.  
  7092.         PROTOTYPE
  7093.  
  7094.         SUB PALCOPY (SrcPalette$, DestPalette$, FirstColor%,
  7095.         LastColor%)
  7096.  
  7097.         INPUT
  7098.  
  7099.         SrcPalette$ - string * 768 containing source palette
  7100.         FirstColor - index into palette where copy will begin
  7101.         LastColor - index into palette where copy will end
  7102.  
  7103.         OUTPUT
  7104.  
  7105.         no value returned
  7106.         DestPalette$ - string * 768 containing copy of source palette
  7107.  
  7108.         USAGE
  7109.  
  7110.         PALCOPY quickly copies a source palette into a second palette
  7111.         array.  The source and destination must both be defined as
  7112.         string * 768 or PALCOPY will return without making any copy.
  7113.         A portion of a palette may be copied by specifying first and
  7114.         last colors.
  7115.  
  7116.         SEE ALSO
  7117.  
  7118.         BYTECOPY
  7119.  
  7120.         EXAMPLE
  7121.  
  7122.         REM SHOW PAL COPY
  7123.         REM $INCLUDE: 'SVGABC.BI'
  7124.         DEFINT A-Z
  7125.         DIM PAL1 AS STRING * 768
  7126.         DIM PAL2 AS STRING * 768
  7127.         VMODE = VIDEOMODEGET
  7128.         IF WHICHVGA = 0 THEN STOP
  7129.         IF WHICHMEM < 512 THEN STOP
  7130.         DUMMY = RES640
  7131.         FOR I = 0 TO 255
  7132.            MID$(PAL1, I * 3 + 1, 1) = CHR$(I)
  7133.            MID$(PAL1, I * 3 + 2, 1) = CHR$(I)
  7134.            MID$(PAL1, I * 3 + 3, 1) = CHR$(I)
  7135.         NEXT I
  7136.         COLR = 0
  7137.         FOR I = 0 TO 639
  7138.            DRWLINE 1, COLR, I, 0, I, 479
  7139.            COLR = COLR + 1
  7140.            IF COLR > 255 THEN COLR = 0
  7141.         NEXT I
  7142.         PALCOPY PAL1, PAL2, 0, 255
  7143.         PALSET PAL2, 0, 255
  7144.  
  7145.  
  7146.                                     109
  7147.  
  7148.  
  7149.  
  7150.  
  7151.  
  7152.  
  7153.         WHILE INKEY$ = ""
  7154.         WEND
  7155.         VIDEOMODESET VMODE
  7156.         END
  7157.  
  7158.  
  7159.  
  7160.  
  7161.  
  7162.  
  7163.  
  7164.  
  7165.  
  7166.  
  7167.  
  7168.  
  7169.  
  7170.  
  7171.  
  7172.  
  7173.  
  7174.  
  7175.  
  7176.  
  7177.  
  7178.  
  7179.  
  7180.  
  7181.  
  7182.  
  7183.  
  7184.  
  7185.  
  7186.  
  7187.  
  7188.  
  7189.  
  7190.  
  7191.  
  7192.  
  7193.  
  7194.  
  7195.  
  7196.  
  7197.  
  7198.  
  7199.  
  7200.  
  7201.  
  7202.  
  7203.  
  7204.  
  7205.  
  7206.  
  7207.  
  7208.  
  7209.                                     110
  7210.  
  7211.  
  7212.  
  7213.  
  7214.  
  7215.  
  7216.       PALDIMSTEP
  7217.  
  7218.         PROTOTYPE
  7219.  
  7220.         SUB PALDIMSTEP (Pal$, FirstColor%, LastColor%, Percent%)
  7221.  
  7222.         INPUT
  7223.  
  7224.         Pal$ - string * 768 containing initial palette
  7225.         FirstColor - index into palette where dim will begin
  7226.         LastColor - index into palette where dim will end
  7227.         Percent - percent step from current palette to black
  7228.  
  7229.         OUTPUT
  7230.  
  7231.         no value returned
  7232.  
  7233.         USAGE
  7234.  
  7235.         PALDIMSTEP fades the specified palette to black by the given
  7236.         percentage between FirstColor and LastColor.  The percentage
  7237.         step from Pal$ to black is specified by Percent where 256 (100
  7238.         hex) is full black.  The valid range for Percent is 0 to 256.
  7239.         Values beyond this range cause the function to immediately
  7240.         return without making any changes.  Pal$ is not modified.
  7241.  
  7242.         SEE ALSO
  7243.  
  7244.         PALCHGAUTO, PALCHGSTEP, PALIOAUTO
  7245.  
  7246.         EXAMPLE
  7247.  
  7248.         REM STEP FADE OUT AND BACK IN FAST
  7249.         REM $INCLUDE: 'SVGABC.BI'
  7250.         DEFINT A-Z
  7251.         DIM PAL AS STRING * 768
  7252.  
  7253.         VMODE = VIDEOMODEGET
  7254.         IF WHICHVGA = 0 THEN STOP
  7255.         IF WHICHMEM < 512 THEN STOP
  7256.         DUMMY=RES640
  7257.         PALGET PAL, 0, 255
  7258.         COLR = 0
  7259.         FOR I = 0 TO 639
  7260.            DRWLINE 1, COLR, I, 0, I, 479
  7261.            COLR = COLR + 1
  7262.            IF COLR > 255 THEN COLR = 0
  7263.         NEXT I
  7264.         FOR I = 255 TO 0 STEP -2
  7265.            PALDIMSTEP PAL, 0, 255, I
  7266.         NEXT I
  7267.         FOR I = 1 TO 255 STEP 16
  7268.            PALDIMSTEP PAL, 0, 255, I
  7269.         NEXT I
  7270.  
  7271.  
  7272.                                     111
  7273.  
  7274.  
  7275.  
  7276.  
  7277.  
  7278.  
  7279.         WHILE INKEY$ = ""
  7280.         WEND
  7281.         VIDEOMODESET VMODE
  7282.         END
  7283.  
  7284.  
  7285.  
  7286.  
  7287.  
  7288.  
  7289.  
  7290.  
  7291.  
  7292.  
  7293.  
  7294.  
  7295.  
  7296.  
  7297.  
  7298.  
  7299.  
  7300.  
  7301.  
  7302.  
  7303.  
  7304.  
  7305.  
  7306.  
  7307.  
  7308.  
  7309.  
  7310.  
  7311.  
  7312.  
  7313.  
  7314.  
  7315.  
  7316.  
  7317.  
  7318.  
  7319.  
  7320.  
  7321.  
  7322.  
  7323.  
  7324.  
  7325.  
  7326.  
  7327.  
  7328.  
  7329.  
  7330.  
  7331.  
  7332.  
  7333.  
  7334.  
  7335.                                     112
  7336.  
  7337.  
  7338.  
  7339.  
  7340.  
  7341.  
  7342.       PALGET
  7343.  
  7344.         PROTOTYPE
  7345.  
  7346.         SUB PALGET (Pal$, FirstColor, LastColor%)
  7347.  
  7348.         INPUT
  7349.  
  7350.         Pal$ - string * 768 to hold current palette
  7351.         FirstColor - index into palette where get will begin
  7352.         LastColor - index into palette where get will end
  7353.  
  7354.         OUTPUT
  7355.  
  7356.         Pal$ - string * 768 containing the current palette in the
  7357.         specified range
  7358.  
  7359.         USAGE
  7360.  
  7361.         PALGET returns in Pal$ the colors from the current palette
  7362.         between FirstColor and LastColor.  Only colors in the
  7363.         specified range are returned and all others in Pal$ are
  7364.         unchanged.  Pal$ must have a length of 768 characters despite
  7365.         the number of colors retrieved.
  7366.  
  7367.         SEE ALSO
  7368.  
  7369.         PALROTATE, PALSET
  7370.  
  7371.         EXAMPLE
  7372.  
  7373.         REM GET THE CURRENT PALETTE IN THE VARIABLE 'PAL'
  7374.         REM $INCLUDE: 'SVGABC.BI'
  7375.         DEFINT A-Z
  7376.         DIM PAL AS STRING * 768
  7377.  
  7378.         VMODE = VIDEOMODEGET
  7379.         IF WHICHVGA = 0 THEN STOP
  7380.         IF WHICHMEM < 512 THEN STOP
  7381.         DUMMY=RES640
  7382.         PALGET PAL, 0, 255
  7383.         VIDEOMODESET VMODE
  7384.         CLS
  7385.         PRINT "GOT IT IN 'PAL'..."
  7386.         WHILE INKEY$ = ""
  7387.         WEND
  7388.         END
  7389.  
  7390.  
  7391.  
  7392.  
  7393.  
  7394.  
  7395.  
  7396.  
  7397.  
  7398.                                     113
  7399.  
  7400.  
  7401.  
  7402.  
  7403.  
  7404.  
  7405.       PALIOAUTO
  7406.  
  7407.         PROTOTYPE
  7408.  
  7409.         SUB PALIOAUTO (Pal$, FirstColor%, LastColor%, Speed%)
  7410.  
  7411.         INPUT
  7412.  
  7413.         Pal$ - string *768 containing initial palette
  7414.         FirstColor - index into palette where fade will begin
  7415.         LastColor - index into palette where fade will end
  7416.         Speed - speed of fade
  7417.  
  7418.         OUTPUT
  7419.  
  7420.         no value returned
  7421.  
  7422.         USAGE
  7423.  
  7424.         PALIOAUTO smoothly fades the colors between FirstColor and
  7425.         LastColor of Pal$ to or from solid black.  The speed of the
  7426.         fade is set by Speed which is the percentage change between
  7427.         each step of the fade.  A positive Speed corresponds to fading
  7428.         from Pal$ to black and a negative Speed fades from black to
  7429.         Pal$.  Only values between -128 and +128 are valid where  1
  7430.         represents a one percent change between steps and  128 ( 80
  7431.         hex) represents fifty percent change between steps.  A Speed
  7432.         of 128 would then have only two steps.  A Speed outside of the
  7433.         valid range causes the function to immediately return without
  7434.         making any changes.  The time required to accomplish the
  7435.         entire fade is approximately equal to 0.033 seconds times 256
  7436.         divided by Speed.  PALIOAUTO does not modify Pal$.
  7437.  
  7438.         SEE ALSO
  7439.  
  7440.         PALCHGAUTO, PALCHGSTEP, PALDIMSTEP
  7441.  
  7442.         EXAMPLE
  7443.  
  7444.         REM FADE OUT AND BACK IN FAST
  7445.         REM $INCLUDE: 'SVGABC.BI'
  7446.         DEFINT A-Z
  7447.         DIM PAL AS STRING * 768
  7448.         VMODE = VIDEOMODEGET
  7449.         IF WHICHVGA = 0 THEN STOP
  7450.         IF WHICHMEM < 512 THEN STOP
  7451.         DUMMY=RES640
  7452.         PALGET PAL, 0, 255
  7453.         COLR = 0
  7454.         FOR I = 0 TO 639
  7455.            DRWLINE 1, COLR, I, 0, I, 479
  7456.            COLR = COLR + 1
  7457.            IF COLR > 255 THEN COLR = 0
  7458.         NEXT I
  7459.  
  7460.  
  7461.                                     114
  7462.  
  7463.  
  7464.  
  7465.  
  7466.  
  7467.  
  7468.         PALIOAUTO PAL, 0, 255, -2
  7469.         PALIOAUTO PAL, 0, 255, 16
  7470.         WHILE INKEY$ = ""
  7471.         WEND
  7472.         VIDEOMODESET VMODE
  7473.         END
  7474.  
  7475.  
  7476.  
  7477.  
  7478.  
  7479.  
  7480.  
  7481.  
  7482.  
  7483.  
  7484.  
  7485.  
  7486.  
  7487.  
  7488.  
  7489.  
  7490.  
  7491.  
  7492.  
  7493.  
  7494.  
  7495.  
  7496.  
  7497.  
  7498.  
  7499.  
  7500.  
  7501.  
  7502.  
  7503.  
  7504.  
  7505.  
  7506.  
  7507.  
  7508.  
  7509.  
  7510.  
  7511.  
  7512.  
  7513.  
  7514.  
  7515.  
  7516.  
  7517.  
  7518.  
  7519.  
  7520.  
  7521.  
  7522.  
  7523.  
  7524.                                     115
  7525.  
  7526.  
  7527.  
  7528.  
  7529.  
  7530.  
  7531.       PALROTATE
  7532.  
  7533.         PROTOTYPE
  7534.  
  7535.         SUB PALROTATE (Pal$, FirstColor%, LastColor%, Shift%)
  7536.  
  7537.         INPUT
  7538.  
  7539.         Pal$ - string * 768 containing current palette
  7540.         FirstColor - index into palette where shift will begin
  7541.         LastColor - index into palette where shift will end
  7542.         Shift - number of locations to shift colors
  7543.  
  7544.         OUTPUT
  7545.  
  7546.         no value returned
  7547.  
  7548.         USAGE
  7549.  
  7550.         PALROTATE shifts the colors between FirstColor and LastColor
  7551.         by a given number of locations.  The number of locations the
  7552.         colors are moved is specified by Shift which is between 1 and
  7553.         256.  Pal$ is not modified by PALROTATE.
  7554.  
  7555.         SEE ALSO
  7556.  
  7557.         PALGET, PALSET
  7558.  
  7559.         EXAMPLE
  7560.  
  7561.         REM ROTATE A FEW PALETTE ENTRIES AROUND
  7562.         REM $INCLUDE: 'SVGABC.BI'
  7563.         DEFINT A-Z
  7564.         DIM PAL AS STRING * 768
  7565.  
  7566.         VMODE = VIDEOMODEGET
  7567.         IF WHICHVGA = 0 THEN STOP
  7568.         IF WHICHMEM < 512 THEN STOP
  7569.         DUMMY=RES640
  7570.         PALGET PAL, 0, 255
  7571.         COLR = 0
  7572.         FOR I = 0 TO 639
  7573.            DRWLINE 1, COLR, I, 0, I, 479
  7574.            COLR = COLR + 1
  7575.            IF COLR > 255 THEN COLR = 0
  7576.         NEXT I
  7577.         FOR I = 0 TO 100
  7578.            PALROTATE PAL, 0, 127, 1
  7579.            PALGET PAL, 0, 255
  7580.         NEXT I
  7581.         WHILE INKEY$ = ""
  7582.         WEND
  7583.         VIDEOMODESET VMODE
  7584.         END
  7585.  
  7586.  
  7587.                                     116
  7588.  
  7589.  
  7590.  
  7591.  
  7592.  
  7593.  
  7594.       PALSET
  7595.  
  7596.         PROTOTYPE
  7597.  
  7598.         SUB PALSET (Pal$, FirstColor%, LastColor%)
  7599.  
  7600.         INPUT
  7601.  
  7602.         Pal$ - string * 768 containing the palette to set
  7603.         FirstColor - index into palette where set will begin
  7604.         LastColor - index into palette where set will end
  7605.  
  7606.         OUTPUT
  7607.  
  7608.         no value returned
  7609.  
  7610.         USAGE
  7611.  
  7612.         PALSET sets the specified range of colors in the current
  7613.         palette with the corresponding range in the palette Pal$.
  7614.  
  7615.         SEE ALSO
  7616.  
  7617.         PALGET
  7618.  
  7619.         EXAMPLE
  7620.  
  7621.         REM SET A NEW PALETTE
  7622.         REM $INCLUDE: 'SVGABC.BI'
  7623.         DEFINT A-Z
  7624.         DIM PAL AS STRING * 768
  7625.         DIM NEWPAL AS STRING * 768
  7626.  
  7627.         VMODE = VIDEOMODEGET
  7628.         IF WHICHVGA = 0 THEN STOP
  7629.         IF WHICHMEM < 512 THEN STOP
  7630.         DUMMY=RES640
  7631.         PALGET PAL, 0, 255
  7632.         FOR I = 1 TO 768
  7633.            MID$(NEWPAL, I, 1) = MID$(PAL, 769 - I, 1)
  7634.         NEXT I
  7635.         COLR = 0
  7636.         FOR I = 0 TO 639
  7637.            DRWLINE 1, COLR, I, 0, I, 479
  7638.            COLR = COLR + 1
  7639.            IF COLR > 255 THEN COLR = 0
  7640.         NEXT I
  7641.         PALSET NEWPAL, 0, 255
  7642.         WHILE INKEY$ = ""
  7643.         WEND
  7644.         VIDEOMODESET VMODE
  7645.         END
  7646.  
  7647.  
  7648.  
  7649.  
  7650.                                     117
  7651.  
  7652.  
  7653.  
  7654.  
  7655.  
  7656.  
  7657.       RES320
  7658.  
  7659.         PROTOTYPE
  7660.  
  7661.         FUNCTION RES320% ()
  7662.  
  7663.         INPUT
  7664.  
  7665.         no input parameters
  7666.  
  7667.         OUTPUT
  7668.  
  7669.         RES320 always returns a 1.
  7670.  
  7671.         USAGE
  7672.  
  7673.         RES320 sets video mode 0x13 which is the VGA standard 320x200
  7674.         graphics mode with 256 colors.  This function can be called
  7675.         without calling WHICHVGA first as this function requires only
  7676.         that a VGA card is present, not a Super VGA card.  If a VGA is
  7677.         not present, the system may crash.
  7678.  
  7679.         SEE ALSO
  7680.  
  7681.         RES640, RES640L, RES800, RES1024, RES1280, WHICHVGA
  7682.  
  7683.         EXAMPLE
  7684.  
  7685.         REM SET THE VIDEO MODE TO 320x200x256
  7686.         REM $INCLUDE: 'SVGABC.BI'
  7687.         DEFINT A-Z
  7688.  
  7689.         VMODE = VIDEOMODEGET
  7690.         IF WHICHVGA = 0 THEN STOP
  7691.         DUMMY=RES320
  7692.         DRWSTRING 1, 7, 0, "THIS IS THE 320x200x256 VIDEO MODE...", 0,
  7693.         0
  7694.         WHILE INKEY$ = ""
  7695.         WEND
  7696.         VIDEOMODESET VMODE
  7697.         END
  7698.  
  7699.  
  7700.  
  7701.  
  7702.  
  7703.  
  7704.  
  7705.  
  7706.  
  7707.  
  7708.  
  7709.  
  7710.  
  7711.  
  7712.  
  7713.                                     118
  7714.  
  7715.  
  7716.  
  7717.  
  7718.  
  7719.  
  7720.       RES640
  7721.  
  7722.         PROTOTYPE
  7723.  
  7724.         FUNCTION RES640% ()
  7725.  
  7726.         INPUT
  7727.  
  7728.         no input parameters
  7729.  
  7730.         OUTPUT
  7731.  
  7732.         RES640 returns 1 if successful, 0 otherwise.
  7733.  
  7734.         USAGE
  7735.  
  7736.         RES640 sets the video mode to 640x480 graphics mode with 256
  7737.         colors.  This function requires that a Super VGA card with at
  7738.         least 512K of video memory be present.  Also, WHICHVGA must be
  7739.         called first or the function will fail without changing the
  7740.         video mode.  If the video card does not have sufficient
  7741.         memory, RES640 will return without changing the video mode.
  7742.  
  7743.         SEE ALSO
  7744.  
  7745.         RES320, RES640L, RES800, RES1024, RES1280, WHICHVGA
  7746.  
  7747.         EXAMPLE
  7748.  
  7749.         REM SET THE VIDEO MODE TO 640x480x256
  7750.         REM $INCLUDE: 'SVGABC.BI'
  7751.         DEFINT A-Z
  7752.  
  7753.         VMODE = VIDEOMODEGET
  7754.         IF WHICHVGA = 0 THEN STOP
  7755.         IF WHICHMEM < 512 THEN STOP
  7756.         DUMMY=RES640
  7757.         DRWSTRING 1, 7, 0, "THIS IS THE 640x480x256 VIDEO MODE...", 0,
  7758.         0
  7759.         WHILE INKEY$ = ""
  7760.         WEND
  7761.         VIDEOMODESET VMODE
  7762.         END
  7763.  
  7764.  
  7765.  
  7766.  
  7767.  
  7768.  
  7769.  
  7770.  
  7771.  
  7772.  
  7773.  
  7774.  
  7775.  
  7776.                                     119
  7777.  
  7778.  
  7779.  
  7780.  
  7781.  
  7782.  
  7783.       RES640L
  7784.  
  7785.         PROTOTYPE
  7786.  
  7787.         FUNCTION RES640L% ()
  7788.  
  7789.         INPUT
  7790.  
  7791.         no input parameters
  7792.  
  7793.         OUTPUT
  7794.  
  7795.         RES640L returns 1 if successful, 0 otherwise.
  7796.  
  7797.         USAGE
  7798.  
  7799.         RES640L sets the video mode to 640x400 graphics mode with 256
  7800.         colors.  This function requires that a Super VGA card with at
  7801.         least 256K of video memory be present.  Also, WHICHVGA must be
  7802.         called first or the function will fail without changing the
  7803.         video mode.  If the video card does not have sufficient
  7804.         memory, RES640L will return without changing the video mode.
  7805.  
  7806.         Note: 640x400 is a non-standard resolution.  Not all SVGA
  7807.         cards recognized by this library support this video mode.
  7808.  
  7809.         SEE ALSO
  7810.  
  7811.         RES320, RES640, RES800, RES1024, RES1280, WHICHVGA
  7812.  
  7813.         EXAMPLE
  7814.  
  7815.         REM SET THE VIDEO MODE TO 640x400x256
  7816.         REM $INCLUDE: 'SVGABC.BI'
  7817.         DEFINT A-Z
  7818.  
  7819.         VMODE = VIDEOMODEGET
  7820.         IF WHICHVGA = 0 THEN STOP
  7821.         IF WHICHMEM < 256 THEN STOP
  7822.         DUMMY=RES640L
  7823.         DRWSTRING 1, 7, 0, "THIS IS THE 640x400x256 VIDEO MODE...", 0,
  7824.         0
  7825.         WHILE INKEY$ = ""
  7826.         WEND
  7827.         VIDEOMODESET VMODE
  7828.         END
  7829.  
  7830.  
  7831.  
  7832.  
  7833.  
  7834.  
  7835.  
  7836.  
  7837.  
  7838.  
  7839.                                     120
  7840.  
  7841.  
  7842.  
  7843.  
  7844.  
  7845.  
  7846.       RES800
  7847.  
  7848.         PROTOTYPE
  7849.  
  7850.         FUNCTION RES800% ()
  7851.  
  7852.         INPUT
  7853.  
  7854.         no input parameters
  7855.  
  7856.         OUTPUT
  7857.  
  7858.         RES800 returns 1 if successful, 0 otherwise.
  7859.  
  7860.         USAGE
  7861.  
  7862.         RES800 sets the video mode to 800x600 graphics mode with 256
  7863.         colors.  This function requires that a Super VGA card with at
  7864.         least 512K of video memory be present.  Also, WHICHVGA must be
  7865.         called first or the function will fail without changing the
  7866.         video mode.  If the video card does not have sufficient
  7867.         memory, RES800 will return without changing the video mode.
  7868.  
  7869.         SEE ALSO
  7870.  
  7871.         RES320, RES640, RES640L, RES1024, RES1280, WHICHVGA
  7872.  
  7873.         EXAMPLE
  7874.  
  7875.         REM SET THE VIDEO MODE TO 800x600x256
  7876.         REM $INCLUDE: 'SVGABC.BI'
  7877.         DEFINT A-Z
  7878.  
  7879.         VMODE = VIDEOMODEGET
  7880.         IF WHICHVGA = 0 THEN STOP
  7881.         IF WHICHMEM < 512 THEN STOP
  7882.         DUMMY=RES800
  7883.         DRWSTRING 1, 7, 0, "THIS IS THE 800x600x256 VIDEO MODE...", 0,
  7884.         0
  7885.         WHILE INKEY$ = ""
  7886.         WEND
  7887.         VIDEOMODESET VMODE
  7888.         END
  7889.  
  7890.  
  7891.  
  7892.  
  7893.  
  7894.  
  7895.  
  7896.  
  7897.  
  7898.  
  7899.  
  7900.  
  7901.  
  7902.                                     121
  7903.  
  7904.  
  7905.  
  7906.  
  7907.  
  7908.  
  7909.       RES1024
  7910.  
  7911.         PROTOTYPE
  7912.  
  7913.         FUNCTION RES1024% ()
  7914.  
  7915.         INPUT
  7916.  
  7917.         no input parameters
  7918.  
  7919.         OUTPUT
  7920.  
  7921.         RES1024 returns 1 if successful, 0 otherwise.
  7922.  
  7923.         USAGE
  7924.  
  7925.         RES1024 sets the video mode to 1024x768 graphics mode with 256
  7926.         colors.  This function requires that a Super VGA card with at
  7927.         least 1 Megabyte of video memory be present.  Also, WHICHVGA
  7928.         must be called first or the function will fail without
  7929.         changing the video mode.  If the video card does not have
  7930.         sufficient memory, RES1024 will return without changing the
  7931.         video mode.
  7932.  
  7933.         SEE ALSO
  7934.  
  7935.         RES320, RES640, RES640L, RES800, RES1280, WHICHVGA
  7936.  
  7937.         EXAMPLE
  7938.  
  7939.         REM SET THE VIDEO MODE TO 1024x768x256
  7940.         REM $INCLUDE: 'SVGABC.BI'
  7941.         DEFINT A-Z
  7942.  
  7943.         VMODE = VIDEOMODEGET
  7944.         IF WHICHVGA = 0 THEN STOP
  7945.         IF WHICHMEM < 1024 THEN STOP
  7946.         DUMMY=RES1024
  7947.         DRWSTRING 1, 7, 0, "THIS IS THE 1024x768x256 VIDEO MODE...",
  7948.         0, 0
  7949.         WHILE INKEY$ = ""
  7950.         WEND
  7951.         VIDEOMODESET VMODE
  7952.         END
  7953.  
  7954.  
  7955.  
  7956.  
  7957.  
  7958.  
  7959.  
  7960.  
  7961.  
  7962.  
  7963.  
  7964.  
  7965.                                     122
  7966.  
  7967.  
  7968.  
  7969.  
  7970.  
  7971.  
  7972.       RES1280
  7973.  
  7974.         PROTOTYPE
  7975.  
  7976.         FUNCTION RES1280% ()
  7977.  
  7978.         INPUT
  7979.  
  7980.         no input parameters
  7981.  
  7982.         OUTPUT
  7983.  
  7984.         RES1280 returns 1 if successful, 0 otherwise.
  7985.  
  7986.         USAGE
  7987.  
  7988.         RES1280 sets the video mode to 1280x1024 graphics mode with
  7989.         256 colors.  This function requires that a Super VGA card with
  7990.         at least 2 Megabytes of video memory be present.  Also,
  7991.         WHICHVGA must be called first or the function will fail
  7992.         without changing the video mode.  If the video card does not
  7993.         have sufficient memory, RES1280 will return without changing
  7994.         the video mode.
  7995.  
  7996.         SEE ALSO
  7997.  
  7998.         RES320, RES640, RES640L, RES800, RES1024, WHICHVGA
  7999.  
  8000.         EXAMPLE
  8001.  
  8002.         REM SET THE VIDEO MODE TO 1280x1024x256
  8003.         REM $INCLUDE: 'SVGABC.BI'
  8004.         DEFINT A-Z
  8005.  
  8006.         VMODE = VIDEOMODEGET
  8007.         IF WHICHVGA = 0 THEN STOP
  8008.         IF WHICHMEM < 2048 THEN STOP
  8009.         DUMMY=RES1024
  8010.         DRWSTRING 1, 7, 0, "THIS IS THE 1280x1024x256 VIDEO MODE...",
  8011.         0, 0
  8012.         WHILE INKEY$ = ""
  8013.         WEND
  8014.         VIDEOMODESET VMODE
  8015.         END
  8016.  
  8017.  
  8018.  
  8019.  
  8020.  
  8021.  
  8022.  
  8023.  
  8024.  
  8025.  
  8026.  
  8027.  
  8028.                                     123
  8029.  
  8030.  
  8031.  
  8032.  
  8033.  
  8034.  
  8035.       RESTEXT
  8036.  
  8037.         PROTOTYPE
  8038.  
  8039.         FUNCTION RESTEXT% ()
  8040.  
  8041.         INPUT
  8042.  
  8043.         no input parameters
  8044.  
  8045.         OUTPUT
  8046.  
  8047.         RESTEXT always returns a 1.
  8048.  
  8049.         USAGE
  8050.  
  8051.         RESTEXT sets video mode three which is the VGA standard 80x25
  8052.         text mode.
  8053.  
  8054.         SEE ALSO
  8055.  
  8056.         VIDEOMODEGET, VIDEOMODESET
  8057.  
  8058.         EXAMPLE
  8059.  
  8060.         REM SET THE VIDEO MODE TO STANDARD DOS TEXT MODE 3
  8061.         REM $INCLUDE: 'SVGABC.BI'
  8062.         DEFINT A-Z
  8063.  
  8064.         VMODE = VIDEOMODEGET
  8065.         RESTEXT
  8066.         PRINT "THIS IS THE TEXT VIDEO MODE (DOS VIDEO MODE 3)...
  8067.         WHILE INKEY$ = ""
  8068.         WEND
  8069.         VIDEOMODESET VMODE
  8070.         END
  8071.  
  8072.  
  8073.  
  8074.  
  8075.  
  8076.  
  8077.  
  8078.  
  8079.  
  8080.  
  8081.  
  8082.  
  8083.  
  8084.  
  8085.  
  8086.  
  8087.  
  8088.  
  8089.  
  8090.  
  8091.                                     124
  8092.  
  8093.  
  8094.  
  8095.  
  8096.  
  8097.  
  8098.       SCROLLDN
  8099.  
  8100.         PROTOTYPE
  8101.  
  8102.         SUB SCROLLDN (X1%, Y1%, X2%, Y2%, Num%, Color%)
  8103.  
  8104.         INPUT
  8105.  
  8106.         X1, Y1 - top left corner of block
  8107.         X2, Y2 - bottom right corner of block
  8108.         Num - number of pixels to shift
  8109.         Color - index to color in current palette
  8110.  
  8111.         OUTPUT
  8112.  
  8113.         no value returned
  8114.  
  8115.         USAGE
  8116.  
  8117.         SCROLLDN shifts the contents of the box described by (X1, Y1)
  8118.         - (X2, Y2) down by the number of pixels specified by Num.  The
  8119.         empty pixels created at the top of the box are filled with
  8120.         Color.  The pixels that are shifted out of the box are lost.
  8121.         SCROLLDN enforces X2 X1 and Y2Y1.  When placed within a loop,
  8122.         SCROLLDN will create a scrolling effect.
  8123.  
  8124.         SEE ALSO
  8125.  
  8126.         SCROLLLT, SCROLLRT, SCROLLUP
  8127.  
  8128.         EXAMPLE
  8129.  
  8130.         REM SCROLL SOME TEXT DOWN
  8131.         REM $INCLUDE: 'SVGABC.BI'
  8132.         DEFINT A-Z
  8133.  
  8134.         VMODE = VIDEOMODEGET
  8135.         IF WHICHVGA = 0 THEN STOP
  8136.         IF WHICHMEM < 512 THEN STOP
  8137.         DUMMY=RES640
  8138.         DRWBOX 1, 10, 0, 0, 100, 100
  8139.         DRWSTRING 1, 7, 0, "TEXT TEXT", 20, 43
  8140.         FOR I = 0 TO 40
  8141.            SCROLLDN 1, 1, 99, 99, 1, 0
  8142.            SDELAY 2
  8143.         NEXT I
  8144.         WHILE INKEY$ = ""
  8145.         WEND
  8146.         VIDEOMODESET VMODE
  8147.         END
  8148.  
  8149.  
  8150.  
  8151.  
  8152.  
  8153.  
  8154.                                     125
  8155.  
  8156.  
  8157.  
  8158.  
  8159.  
  8160.  
  8161.       SCROLLLT
  8162.  
  8163.         PROTOTYPE
  8164.  
  8165.         SUB SCROLLLT (X1%, Y1%, X2%, Y2%, Num%, Color%)
  8166.  
  8167.         INPUT
  8168.  
  8169.         X1, Y1 - top left corner of block
  8170.         X2, Y2 - bottom right corner of block
  8171.         Num - number of pixels to shift
  8172.         Color - index to color in current palette
  8173.  
  8174.         OUTPUT
  8175.  
  8176.         no value returned
  8177.  
  8178.         USAGE
  8179.  
  8180.         SCROLLLT shifts the contents of the box described by (X1, Y1)
  8181.         - (X2, Y2) down by the number of pixels specified by Num.  The
  8182.         empty pixels created at the right of the box are filled with
  8183.         Color.  The pixels that are shifted out of the box are lost.
  8184.         SCROLLLT enforces X2 X1 and Y2Y1.  When placed within a loop,
  8185.         SCROLLRT will create a scrolling effect.
  8186.  
  8187.         SEE ALSO
  8188.  
  8189.         SCROLLDN, SCROLLRT, SCROLLUP
  8190.  
  8191.         EXAMPLE
  8192.  
  8193.         REM SCROLL SOME TEXT LEFT
  8194.         REM $INCLUDE: 'SVGABC.BI'
  8195.         DEFINT A-Z
  8196.  
  8197.         VMODE = VIDEOMODEGET
  8198.         IF WHICHVGA = 0 THEN STOP
  8199.         IF WHICHMEM < 512 THEN STOP
  8200.         DUMMY=RES640
  8201.         DRWBOX 1, 10, 0, 0, 100, 100
  8202.         DRWSTRING 1, 7, 0, "TEXT TEXT", 20, 43
  8203.         FOR I = 0 TO 40
  8204.            SCROLLLT 1, 1, 99, 99, 1, 0
  8205.            SDELAY 2
  8206.         NEXT I
  8207.         WHILE INKEY$ = ""
  8208.         WEND
  8209.         VIDEOMODESET VMODE
  8210.         END
  8211.  
  8212.  
  8213.  
  8214.  
  8215.  
  8216.  
  8217.                                     126
  8218.  
  8219.  
  8220.  
  8221.  
  8222.  
  8223.  
  8224.       SCROLLRT
  8225.  
  8226.         PROTOTYPE
  8227.  
  8228.         SUB SCROLLRT (X1%, Y1%, X2%, Y2%, Num%, Color%)
  8229.  
  8230.         INPUT
  8231.  
  8232.         X1, Y1 - top left corner of block
  8233.         X2, Y2 - bottom right corner of block
  8234.         Num - number of pixels to shift
  8235.         Color - index to color in current palette
  8236.  
  8237.         OUTPUT
  8238.  
  8239.         no value returned
  8240.  
  8241.         USAGE
  8242.  
  8243.         SCROLLRT shifts the contents of the box described by (X1, Y1)
  8244.         - (X2, Y2) down by the number of pixels specified by Num.  The
  8245.         empty pixels created at the left of the box are filled with
  8246.         Color.  The pixels that are shifted out of the box are lost.
  8247.         SCROLLRT enforces X2 X1 and Y2Y1.  When placed within a loop,
  8248.         SCROLLRT will create a scrolling effect.
  8249.  
  8250.         SEE ALSO
  8251.  
  8252.         SCROLLDN, SCROLLLT, SCROLLUP
  8253.  
  8254.         EXAMPLE
  8255.  
  8256.         REM SCROLL SOME TEXT RIGHT
  8257.         REM $INCLUDE: 'SVGABC.BI'
  8258.         DEFINT A-Z
  8259.  
  8260.         VMODE = VIDEOMODEGET
  8261.         IF WHICHVGA = 0 THEN STOP
  8262.         IF WHICHMEM < 512 THEN STOP
  8263.         DUMMY=RES640
  8264.         DRWBOX 1, 10, 0, 0, 100, 100
  8265.         DRWSTRING 1, 7, 0, "TEXT TEXT", 20, 43
  8266.         FOR I = 0 TO 40
  8267.            SCROLLRT 1, 1, 99, 99, 1, 0
  8268.            SDELAY 2
  8269.         NEXT I
  8270.         WHILE INKEY$ = ""
  8271.         WEND
  8272.         VIDEOMODESET VMODE
  8273.         END
  8274.  
  8275.  
  8276.  
  8277.  
  8278.  
  8279.  
  8280.                                     127
  8281.  
  8282.  
  8283.  
  8284.  
  8285.  
  8286.  
  8287.       SCROLLUP
  8288.  
  8289.         PROTOTYPE
  8290.  
  8291.         SUB SCROLLUP (X1%, Y1%, X2%, Y2%, Num%, Color%)
  8292.  
  8293.         INPUT
  8294.  
  8295.         X1, Y1 - top left corner of block
  8296.         X2, Y2 - bottom right corner of block
  8297.         Num - number of pixels to shift
  8298.         Color - index to color in current palette
  8299.  
  8300.         OUTPUT
  8301.  
  8302.         no value returned
  8303.  
  8304.         USAGE
  8305.  
  8306.         SCROLLUP shifts the contents of the box described by (X1, Y1)
  8307.         - (X2, Y2) down by the number of pixels specified by Num.  The
  8308.         empty pixels created at the bottom of the box are filled with
  8309.         Color.  The pixels that are shifted out of the box are lost.
  8310.         SCROLLUP enforces X2 X1 and Y2Y1.  When placed within a loop,
  8311.         SCROLLUP will create a scrolling effect.
  8312.  
  8313.         SEE ALSO
  8314.  
  8315.         SCROLLDN, SCROLLLT, SCROLLRT
  8316.  
  8317.         EXAMPLE
  8318.  
  8319.         REM SCROLL SOME TEXT UP
  8320.         REM $INCLUDE: 'SVGABC.BI'
  8321.         DEFINT A-Z
  8322.  
  8323.         VMODE = VIDEOMODEGET
  8324.         IF WHICHVGA = 0 THEN STOP
  8325.         IF WHICHMEM < 512 THEN STOP
  8326.         DUMMY=RES640
  8327.         DRWBOX 1, 10, 0, 0, 100, 100
  8328.         DRWSTRING 1, 7, 0, "TEXT TEXT", 20, 43
  8329.         FOR I = 0 TO 40
  8330.            SCROLLUP 1, 1, 99, 99, 1, 0
  8331.            SDELAY 2
  8332.         NEXT I
  8333.         WHILE INKEY$ = ""
  8334.         WEND
  8335.         VIDEOMODESET VMODE
  8336.         END
  8337.  
  8338.  
  8339.  
  8340.  
  8341.  
  8342.  
  8343.                                     128
  8344.  
  8345.  
  8346.  
  8347.  
  8348.  
  8349.  
  8350.       SDELAY
  8351.  
  8352.         PROTOTYPE
  8353.  
  8354.         SUB SDELAY (Count%)
  8355.  
  8356.         INPUT
  8357.  
  8358.         Count - number of vertical syncs to wait
  8359.  
  8360.         OUTPUT
  8361.  
  8362.         no value returned
  8363.  
  8364.         USAGE
  8365.  
  8366.         SDELAY pauses execution of the program for a period of time
  8367.         specified by Count.  This delay remains approximately constant
  8368.         on all machines by using the vertical sync timer of the VGA
  8369.         graphics card which is about 60 - 70 Hz.
  8370.  
  8371.         EXAMPLE
  8372.  
  8373.         REM MAKE A DELAY ABOUT 3 SECONDS LONG
  8374.         REM $INCLUDE: 'SVGABC.BI'
  8375.         DEFINT A-Z
  8376.  
  8377.         CLS
  8378.         PRINT "OK...STARTING DELAY NOW..."
  8379.         PRINT "SHOULD BE ABOUT 3 SECONDS..."
  8380.         PRINT
  8381.         TIM! = TIMER
  8382.         SDELAY 195
  8383.         TOT! = TIMER - TIM!
  8384.         PRINT "ACTUAL TIME WAS:"; TOT!
  8385.         WHILE INKEY$ = ""
  8386.         WEND
  8387.         END
  8388.  
  8389.  
  8390.  
  8391.  
  8392.  
  8393.  
  8394.  
  8395.  
  8396.  
  8397.  
  8398.  
  8399.  
  8400.  
  8401.  
  8402.  
  8403.  
  8404.  
  8405.  
  8406.                                     129
  8407.  
  8408.  
  8409.  
  8410.  
  8411.  
  8412.  
  8413.       SETCARD
  8414.  
  8415.         PROTOTYPE
  8416.  
  8417.         SUB SETCARD (Chip%, Mem%)
  8418.  
  8419.         INPUT
  8420.  
  8421.         Chip - code for certain SVGA chip type
  8422.         Mem - amount of video memory installed
  8423.  
  8424.         OUTPUT
  8425.  
  8426.         no value returned
  8427.  
  8428.         USAGE
  8429.  
  8430.         WARNING:  USING SETCARD IMPROPERLY MAY CAUSE A SYSTEM FAILURE
  8431.         OR DAMAGE.
  8432.         SETCARD sets the card type and installed video memory.  It can
  8433.         be used instead of the WHICHVGA function.  However, specifying
  8434.         an incorrect chip type or installed video memory may cause
  8435.         unpredictable results not excluding damage to the SVGA card
  8436.         and/or monitor.  Extreme caution is advised when using this
  8437.         function.  It is recommended that this function only be used
  8438.         when it is suspected that the identification process in
  8439.         WHICHVGA failed.  Be absolutely certain that the chip type
  8440.         specified is the actual chip type installed in the computer.
  8441.         Mem should be a value of 256, 512 or 1024 representing the
  8442.         kilobytes of video memory installed.  Use the following table
  8443.         to identify chip types:
  8444.  
  8445.       1  Acumos AVGA2/3 SuperVGA
  8446.       2  ATI Technologies 18/28/38/68800
  8447.          SuperVGA
  8448.       3  Ahead V5000 ver A SuperVGA
  8449.       4  Ahead V5000 ver B SuperVGA
  8450.       5  Chips and Technologies 82C45x SuperVGA
  8451.       6  Cirrus Logic CL-GD 5xx, 6xx, 28xx,
  8452.          54xx, 62xx SuperVGA
  8453.       7  Everex Micro Enhancer Ev236/6xx
  8454.          SuperVGA
  8455.       8  Genoa 61/62/63/64/6600 SuperVGA
  8456.       9  NCR 77C21/22/22E/22E+ SuperVGA
  8457.       10 Oak Technologies OTI-037C/067/077/087
  8458.          SuperVGA
  8459.       11 Paradise/Western Digital PVGA1A,
  8460.          WD90C00/1x/2x/3x SuperVGA
  8461.       12 Realtek RT3106 SuperVGA
  8462.       13 Trident 8800CS, 8900B/C/CL/CX, 90x0
  8463.          SuperVGA
  8464.       14 Tseng Labs ET3000-AX/BX/BP SuperVGA
  8465.       15 Tseng Labs ET4000/W32/W32I SuperVGA
  8466.       16 VESA compatible SuperVGA
  8467.  
  8468.  
  8469.                                     130
  8470.  
  8471.  
  8472.  
  8473.  
  8474.  
  8475.  
  8476.       17 Video 7 HT-208/16 SuperVGA
  8477.       18 Avance Logic AL2101 SuperVGA
  8478.       19 MXIC MX68000/10 SuperVGA
  8479.       20 Primus P2000 SuperVGA
  8480.  
  8481.         SEE ALSO
  8482.  
  8483.         WHICHVGA
  8484.  
  8485.         EXAMPLE
  8486.  
  8487.         REM
  8488.         !WARNING!WARNING!WARNING!WARNING!WARNING!WARNING!WARNING!WARNI
  8489.         NG!
  8490.  
  8491.         REM USE THIS FUNCTION CAREFULLY. IT WORKS AROUND THE "WHICHVGA
  8492.         FUNCTION"
  8493.         REM IMPROPER USE (I.E. SETTING THE CARD ID AND MEMORY TO
  8494.         SOMETHING THAT
  8495.         REM THAT IS NOT VALID) MIGHT DAMAGE YOUR VIDEO CARD/VIDEO
  8496.         MONITOR OR
  8497.         REM CAUSE UNPREDICTABLE RESULTS. IT IS PROVIDED AS A METHOD TO
  8498.         FIND
  8499.         REM FAULTS IN THE VIDEO CARD/CHIP ID PROCESS.
  8500.  
  8501.         REM
  8502.         !WARNING!WARNING!WARNING!WARNING!WARNING!WARNING!WARNING!WARNI
  8503.         NG!
  8504.  
  8505.         END
  8506.  
  8507.  
  8508.  
  8509.  
  8510.  
  8511.  
  8512.  
  8513.  
  8514.  
  8515.  
  8516.  
  8517.  
  8518.  
  8519.  
  8520.  
  8521.  
  8522.  
  8523.  
  8524.  
  8525.  
  8526.  
  8527.  
  8528.  
  8529.  
  8530.  
  8531.  
  8532.                                     131
  8533.  
  8534.  
  8535.  
  8536.  
  8537.  
  8538.  
  8539.       SETVIEW
  8540.  
  8541.         PROTOTYPE
  8542.  
  8543.         SUB SETVIEW (X1%, Y1%, X2%, Y2%)
  8544.  
  8545.         INPUT
  8546.  
  8547.         X1, Y1 - top, left corner of view port
  8548.         X2, Y2 - bottom, right corner of view port
  8549.  
  8550.         OUTPUT
  8551.  
  8552.         no value returned
  8553.  
  8554.         USAGE
  8555.  
  8556.         SETVIEW defines a viewport for clipping output on the screen.
  8557.         Nothing can be drawn outside of the currently defined
  8558.         viewport.  The RES### functions set the viewport to the full
  8559.         screen.  The restrictions on X1, Y1, X2 and Y2 are as follows:
  8560.  
  8561.         0   X1 < X2  (screen width)
  8562.         0   Y1 < Y2  (32767, effectively unbounded)
  8563.  
  8564.         SEE ALSO
  8565.  
  8566.         RES320, RES640, RES640L, RES800, RES1024, RES1280
  8567.  
  8568.         EXAMPLE
  8569.  
  8570.         REM DRAW SOME LINES CLIPPED TO A VIEWPORT
  8571.         REM $INCLUDE: 'SVGABC.BI'
  8572.         DEFINT A-Z
  8573.  
  8574.         VMODE = VIDEOMODEGET
  8575.         IF WHICHVGA = 0 THEN STOP
  8576.         IF WHICHMEM < 512 THEN STOP
  8577.         DUMMY=RES640
  8578.         DRWBOX 1, 15, 100, 100, 539, 379
  8579.         SETVIEW 101, 101, 538, 378
  8580.         FOR I = 0 TO 300
  8581.            X1 = RND * 640
  8582.            Y1 = RND * 480
  8583.            X2 = RND * 640
  8584.            Y2 = RND * 480
  8585.            DRWLINE 1, 10, X1, Y1, X2, Y2
  8586.         NEXT I
  8587.         WHILE INKEY$ = ""
  8588.         WEND
  8589.         VIDEOMODESET VMODE
  8590.         END
  8591.  
  8592.  
  8593.  
  8594.  
  8595.                                     132
  8596.  
  8597.  
  8598.  
  8599.  
  8600.  
  8601.  
  8602.       SPRITECOLLDETECT
  8603.  
  8604.         PROTOTYPE
  8605.  
  8606.         FUNCTION SPRITECOLLDETECT% (TransColor%, X1%, Y1%, X2%, Y2%,
  8607.         GfxBlk1%, GfxBlk2%)
  8608.  
  8609.         INPUT
  8610.  
  8611.         TransColor - index to color in current palette
  8612.         X1, Y1 - top, left corner of sprite number 1
  8613.         X2, Y2 - top, left corner of sprite number 2
  8614.         GfxBlk1 - predefined integer array containing the sprite
  8615.         number 1
  8616.         GfxBlk2 - predefined integer array containing the sprite
  8617.         number 2
  8618.  
  8619.         OUTPUT
  8620.  
  8621.         SPRITECOLLDETECT returns the collision status of the two
  8622.         sprites.
  8623.  
  8624.         USAGE
  8625.  
  8626.         SPRITECOLLDETECT is used in sprite graphics or animation to
  8627.         report the collision status between two sprites.  GfxBlk1, a
  8628.         short integer array, contains the first sprite which should
  8629.         have been previously defined by BLKGET or similar function.
  8630.         GfxBlk2, likewise, contains the second sprite.  The top, left
  8631.         corner of the first and second sprites' locations are
  8632.         specified by X1, Y1 and X2, Y2, respectively.
  8633.  
  8634.         SPRITECOLLDETECT will return a zero if the sprites are not
  8635.         colliding and the blocks are not overlapping.  The return will
  8636.         be one if the blocks overlap, but the sprites are not
  8637.         colliding.  A return value of two indicates that the sprites
  8638.         have at least one overlapping pixel and are, therefore,
  8639.         colliding.
  8640.  
  8641.         Arrays should be passed by giving the element within the array
  8642.         from where the action should take place.  This allows the
  8643.         programmer to store more than one item within the same array
  8644.         or act on only a portion of the array.
  8645.  
  8646.         SEE ALSO
  8647.  
  8648.         BLKGET, BLKPUT, GETLASTSTRING, SPRITEGAP, SPRITEGET, SPRITEPUT
  8649.  
  8650.         EXAMPLE
  8651.  
  8652.         REM SHOW THE RESULTS OF THE SPRITE COLLISION DETECTION
  8653.         FUNCTION
  8654.         REM $INCLUDE: 'SVGABC.BI'
  8655.  
  8656.  
  8657.  
  8658.                                     133
  8659.  
  8660.  
  8661.  
  8662.  
  8663.  
  8664.  
  8665.         DEFINT A-Z
  8666.  
  8667.         DIM D1(0 TO 4000) AS INTEGER
  8668.         DIM D2(0 TO 4000) AS INTEGER
  8669.  
  8670.         IF WHICHVGA < 0 THEN STOP
  8671.         ORGMODE = VIDEOMODEGET
  8672.         DUMMY=RES320
  8673.         X1 = 0
  8674.         Y1 = 0
  8675.         X2 = 24
  8676.         Y2 = 24
  8677.         DRWLINE 1, 8, X1, Y1, X2, Y1
  8678.         DRWLINE 1, 8, X2, Y1, X2, Y2
  8679.         DRWLINE 1, 8, X2, Y2, X1, Y2
  8680.         DRWLINE 1, 8, X1, Y2, X1, Y1
  8681.         FILLAREA X1 + 1, Y1 + 1, 8, 8
  8682.         DRWLINE 1, 10, X1, Y1, X2, Y2
  8683.         DRWLINE 1, 10, X2, Y1, X1, Y2
  8684.         BLKGET X1, Y1, X2, Y2, D1(0)
  8685.         BLKPUT 2, X1, Y1, D1(0)
  8686.         X1 = 0
  8687.         Y1 = 0
  8688.         X2 = 48
  8689.         Y2 = 48
  8690.         DRWLINE 1, 8, X1, Y1, X2, Y1
  8691.         DRWLINE 1, 8, X2, Y1, X2, Y2
  8692.         DRWLINE 1, 8, X2, Y2, X1, Y2
  8693.         DRWLINE 1, 8, X1, Y2, X1, Y1
  8694.         FILLAREA X1 + 1, Y1 + 1, 8, 8
  8695.         DRWCIRCLE 1, 10, X1 + 24, Y1 + 24, 24
  8696.         BLKGET X1, Y1, X2, Y2, D2(0)
  8697.         BLKPUT 2, X1, Y1, D2(0)
  8698.         X1 = 90
  8699.         Y1 = 90
  8700.         BLKPUT 2, X1, Y1, D2(0)
  8701.         FOR X = 50 TO 150
  8702.            BLKPUT 2, X, X, D1(0)
  8703.            A = SPRITECOLLDETECT(8, X, X, X1, Y1, D1(0), D2(0))
  8704.            A$ = STR$(A)
  8705.            IF LEN(A$) < 5 THEN A$ = A$ + " "
  8706.            DRWSTRING 1, 7, 0, A$, 0, 0
  8707.            WHILE INKEY$ = ""
  8708.            WEND
  8709.            BLKPUT 2, X, X, D1(0)
  8710.         NEXT X
  8711.         VIDEOMODESET ORGMODE
  8712.         END
  8713.  
  8714.  
  8715.  
  8716.  
  8717.  
  8718.  
  8719.  
  8720.  
  8721.                                     134
  8722.  
  8723.  
  8724.  
  8725.  
  8726.  
  8727.  
  8728.       SPRITEGAP
  8729.  
  8730.         PROTOTYPE
  8731.  
  8732.         SUB SPRITEGAP (TransColor%, X%, Y%, GfxBlk%, BkGndGfxBlk%)
  8733.  
  8734.         INPUT
  8735.  
  8736.         TransColor - index to color in current palette
  8737.         X, Y - top, left corner of block
  8738.         GfxBlk - predefined integer array containing the sprite
  8739.  
  8740.         OUTPUT
  8741.  
  8742.         no value returned
  8743.         BkGndGfxBlk - integer array holding the sprite background
  8744.  
  8745.         USAGE
  8746.  
  8747.         SPRITEGAP ("Sprite-Get-And-Put") is used in sprite graphics or
  8748.         animation to retrieve a sprite's background and then display
  8749.         the sprite.  GfxBlk, a short integer array, contains the
  8750.         sprite which should have been previously defined by BLKGET or
  8751.         similar function such as GETLASTSTRING.  TransColor is the
  8752.         transparent color assumed in GfxBlk.  BkGndGfxBlk, an empty
  8753.         short integer array the same size as GfxBlk, will receive the
  8754.         sprite's background.  The top, left corner of the sprite's
  8755.         location is specified by X, Y.
  8756.  
  8757.         Arrays should be passed by giving the element within the array
  8758.         from where the action should take place.  This allows the
  8759.         programmer to store more than one item within the same array
  8760.         or act on only a portion of the array.
  8761.  
  8762.         SEE ALSO
  8763.  
  8764.         BLKGET, BLKPUT, GETLASTSTRING, SPRITECOLLDETECT, SPRITEGET,
  8765.         SPRITEPUT
  8766.  
  8767.         EXAMPLE
  8768.  
  8769.         REM SHOW SPRITEGAP
  8770.         REM $INCLUDE: 'SVGABC.BI'
  8771.         DEFINT A-Z
  8772.         DIM GFXBLK1(10000)
  8773.         DIM GFXBLK2(10000)
  8774.         DIM GFXBLK3(10000)
  8775.  
  8776.         IF WHICHVGA = 0 THEN STOP
  8777.         VMODE = VIDEOMODEGET
  8778.         IF RES640 <> 1 THEN
  8779.            VIDEOMODESET VMODE
  8780.            END
  8781.         END IF
  8782.  
  8783.  
  8784.                                     135
  8785.  
  8786.  
  8787.  
  8788.  
  8789.  
  8790.  
  8791.         Colr = 1
  8792.         FOR I = 0 TO GETMAXX \ 2
  8793.            DRWCIRCLE 1, Colr, GETMAXX \ 4 + I, GETMAXY \ 2, GETMAXY \ 5
  8794.            Colr = Colr + 1
  8795.            IF Colr > 15 THEN
  8796.          Colr = 1
  8797.            END IF
  8798.         NEXT I
  8799.         XINC = GETMAXX \ 20
  8800.         YINC = GETMAXY \ 20
  8801.         X1 = GETMAXX \ 2 - XINC
  8802.         Y1 = GETMAXY \ 2 - YINC
  8803.         X2 = GETMAXX \ 2 + XINC
  8804.         Y2 = GETMAXY \ 2 + YINC
  8805.         X = (X2 - X1) \ 2 + X1
  8806.         Y = (Y2 - Y1) \ 2 + Y1
  8807.         BLKGET X1, Y1, X2, Y2, GFXBLK1(0)
  8808.         DRWBOX 1, 0, X1, Y1, X2, Y2
  8809.         FILLAREA X1 + 2, Y1 + 2, 0, 0
  8810.         BLKGET X1, Y1, X2, Y2, GFXBLK3(0)
  8811.         FOR I = 0 TO 360 STEP 3
  8812.            DUMMY = BLKROTATE(I, 1, GFXBLK1(0), GFXBLK2(0))
  8813.            SPRITEPUT 1, 1, X - GFXBLK3(0) \ 2, Y - GFXBLK3(1) \ 2,
  8814.         GFXBLK3(0)
  8815.            SPRITEGAP 1, X - GFXBLK2(0) \ 2, Y - GFXBLK2(1) \ 2,
  8816.         GFXBLK2(0), GFXBLK3(0)
  8817.            SDELAY 3
  8818.         NEXT I
  8819.         SPRITEPUT 1, 1, X - GFXBLK3(0) \ 2, Y - GFXBLK3(1) \ 2,
  8820.         GFXBLK3(0)
  8821.         BLKPUT 1, X1, Y1, GFXBLK1(0)
  8822.         VIDEOMODESET VMODE
  8823.         END
  8824.  
  8825.  
  8826.  
  8827.  
  8828.  
  8829.  
  8830.  
  8831.  
  8832.  
  8833.  
  8834.  
  8835.  
  8836.  
  8837.  
  8838.  
  8839.  
  8840.  
  8841.  
  8842.  
  8843.  
  8844.  
  8845.  
  8846.  
  8847.                                     136
  8848.  
  8849.  
  8850.  
  8851.  
  8852.  
  8853.  
  8854.       SPRITEGET
  8855.  
  8856.         PROTOTYPE
  8857.  
  8858.         SUB SPRITEGET (TransColor%, X%, Y%, GfxBlk%, BkGndGfxBlk%)
  8859.  
  8860.         INPUT
  8861.  
  8862.         TransColor - index to color in current palette
  8863.         X, Y - top, left corner of block
  8864.         GfxBlk - predefined integer array containing the sprite
  8865.  
  8866.         OUTPUT
  8867.  
  8868.         no value returned
  8869.         BkGndGfxBlk - integer array holding the sprite background
  8870.  
  8871.         USAGE
  8872.  
  8873.         SPRITEGET is used in sprite graphics or animation to retrieve
  8874.         the background for a sprite, normally just before using
  8875.         SPRITEPUT.  GfxBlk, a short integer array, contains the sprite
  8876.         which should have been previously defined by BLKGET or similar
  8877.         function.  TransColor is the transparent color assumed in
  8878.         GfxBlk.  BkGndGfxBlk, an empty short integer array of the same
  8879.         size as GfxBlk, will receive the sprite's background.  The
  8880.         top, left corner of the sprite's location is specified by X,
  8881.         Y.
  8882.  
  8883.         Arrays should be passed by giving the element within the array
  8884.         from where the action should take place.  This allows the
  8885.         programmer to store more than one item within the same array
  8886.         or act on only a portion of the array.
  8887.  
  8888.         SEE ALSO
  8889.  
  8890.         BLKGET, BLKPUT, GETLASTSTRING, SPRITECOLLDETECT, SPRITEGAP,
  8891.         SPRITEPUT
  8892.  
  8893.         EXAMPLE
  8894.  
  8895.         REM SHOW SPRITEGET
  8896.         REM $INCLUDE: 'SVGABC.BI'
  8897.         DEFINT A-Z
  8898.         DIM GFXBLK1(10000)
  8899.         DIM GFXBLK2(10000)
  8900.         DIM GFXBLK3(10000)
  8901.  
  8902.         IF WHICHVGA = 0 THEN STOP
  8903.         VMODE = VIDEOMODEGET
  8904.         IF RES640 <> 1 THEN
  8905.            VIDEOMODESET VMODE
  8906.            END
  8907.         END IF
  8908.  
  8909.  
  8910.                                     137
  8911.  
  8912.  
  8913.  
  8914.  
  8915.  
  8916.  
  8917.         Colr = 1
  8918.         FOR I = 0 TO GETMAXX \ 2
  8919.            DRWCIRCLE 1, Colr, GETMAXX \ 4 + I, GETMAXY \ 2, GETMAXY \ 5
  8920.            Colr = Colr + 1
  8921.            IF Colr > 15 THEN
  8922.          Colr = 1
  8923.            END IF
  8924.         NEXT I
  8925.         XINC = GETMAXX \ 20
  8926.         YINC = GETMAXY \ 20
  8927.         X1 = GETMAXX \ 2 - XINC
  8928.         Y1 = GETMAXY \ 2 - YINC
  8929.         X2 = GETMAXX \ 2 + XINC
  8930.         Y2 = GETMAXY \ 2 + YINC
  8931.         X = (X2 - X1) \ 2 + X1
  8932.         Y = (Y2 - Y1) \ 2 + Y1
  8933.         BLKGET X1, Y1, X2, Y2, GFXBLK1(0)
  8934.         DRWBOX 1, 0, X1, Y1, X2, Y2
  8935.         FILLAREA X1 + 2, Y1 + 2, 0, 0
  8936.         BLKGET X1, Y1, X2, Y2, GFXBLK3(0)
  8937.         FOR I = 0 TO 360 STEP 3
  8938.            DUMMY = BLKROTATE(I, 1, GFXBLK1(0), GFXBLK2(0))
  8939.            SPRITEPUT 1, 1, X - GFXBLK3(0) \ 2, Y - GFXBLK3(1) \ 2,
  8940.         GFXBLK3(0)
  8941.            SPRITEGET 1, X - GFXBLK2(0) \ 2, Y - GFXBLK2(1) \ 2,
  8942.         GFXBLK2(0), GFXBLK3(0)
  8943.            SPRITEPUT 1, 1, X - GFXBLK2(0) \ 2, Y - GFXBLK2(1) \ 2,
  8944.         GFXBLK2(0)
  8945.            SDELAY 3
  8946.         NEXT I
  8947.         SPRITEPUT 1, 1, X - GFXBLK3(0) \ 2, Y - GFXBLK3(1) \ 2,
  8948.         GFXBLK3(0)
  8949.         BLKPUT 1, X1, Y1, GFXBLK1(0)
  8950.         VIDEOMODESET VMODE
  8951.         END
  8952.  
  8953.  
  8954.  
  8955.  
  8956.  
  8957.  
  8958.  
  8959.  
  8960.  
  8961.  
  8962.  
  8963.  
  8964.  
  8965.  
  8966.  
  8967.  
  8968.  
  8969.  
  8970.  
  8971.  
  8972.  
  8973.                                     138
  8974.  
  8975.  
  8976.  
  8977.  
  8978.  
  8979.  
  8980.       SPRITEPUT
  8981.  
  8982.         PROTOTYPE
  8983.  
  8984.         SUB SPRITEPUT (Mode%, TransColor%, X%, Y%, GfxBlk%)
  8985.  
  8986.         INPUT
  8987.  
  8988.         Mode - pixel write mode (SET=1, XOR=2, OR=3, AND=4)
  8989.         TransColor - index to color in current palette
  8990.         X, Y - top, left corner of block
  8991.         GfxBlk - predefined integer array containing the sprite
  8992.  
  8993.         OUTPUT
  8994.  
  8995.         no value returned
  8996.  
  8997.         USAGE
  8998.  
  8999.         SPRITEPUT is used in sprite graphics or animation to display a
  9000.         sprite or, more commonly, its background.  GfxBlk, a short
  9001.         integer array, contains the sprite which should have been
  9002.         previously defined by BLKGET,  SPRITEGAP or SPRITEGET.
  9003.         TransColor is the transparent color assumed in GfxBlk.  The
  9004.         top, left corner of the sprite's location is specified by X,
  9005.         Y.
  9006.  
  9007.         Arrays should be passed by giving the element within the array
  9008.         from where the action should take place.  This allows the
  9009.         programmer to store more than one item within the same array
  9010.         or act on only a portion of the array.
  9011.  
  9012.         SEE ALSO
  9013.  
  9014.         BLKGET, BLKPUT, GETLASTSTRING, SPRITECOLLDETECT, SPRITEGAP,
  9015.         SPRITEGET
  9016.  
  9017.         EXAMPLE
  9018.  
  9019.         See SPRITEGAP
  9020.  
  9021.  
  9022.  
  9023.  
  9024.  
  9025.  
  9026.  
  9027.  
  9028.  
  9029.  
  9030.  
  9031.  
  9032.  
  9033.  
  9034.  
  9035.  
  9036.                                     139
  9037.  
  9038.  
  9039.  
  9040.  
  9041.  
  9042.  
  9043.       VIDEOMODEGET
  9044.  
  9045.         PROTOTYPE
  9046.  
  9047.         FUNCTION VIDEOMODEGET% ()
  9048.  
  9049.         INPUT
  9050.  
  9051.         no input parameters
  9052.  
  9053.         OUTPUT
  9054.  
  9055.         VIDEOMODEGET returns the current video mode.
  9056.  
  9057.         USAGE
  9058.  
  9059.         VIDEOMODEGET returns the current video mode.  This function is
  9060.         best used to retrieve the video mode being used when a program
  9061.         begins.  When the program ends, this video mode can then be
  9062.         restored using VIDEOMODESET.
  9063.  
  9064.         SEE ALSO
  9065.  
  9066.         RES320, RES640, RES640L, RES800, RES1024, RES1280, RESTEXT,
  9067.         VIDEOMODESET
  9068.  
  9069.         EXAMPLE
  9070.  
  9071.         REM SAVE THE VIDEO MODE,SWITCH TO 640X480X256, RESTORE THE
  9072.         ORIGINAL MODE
  9073.         REM $INCLUDE: 'SVGABC.BI'
  9074.         DEFINT A-Z
  9075.  
  9076.         VMODE = VIDEOMODEGET
  9077.         IF WHICHVGA = 0 THEN STOP
  9078.         IF WHICHMEM < 512 THEN STOP
  9079.         DUMMY=RES640
  9080.         DRWSTRING 1, 7, 0, "PRESS A KEY...", 0, 0
  9081.         WHILE INKEY$ = ""
  9082.         WEND
  9083.         VIDEOMODESET VMODE
  9084.         END
  9085.  
  9086.  
  9087.  
  9088.  
  9089.  
  9090.  
  9091.  
  9092.  
  9093.  
  9094.  
  9095.  
  9096.  
  9097.  
  9098.  
  9099.                                     140
  9100.  
  9101.  
  9102.  
  9103.  
  9104.  
  9105.  
  9106.       VIDEOMODESET
  9107.  
  9108.         PROTOTYPE
  9109.  
  9110.         SUB VIDEOMODESET (Mode%)
  9111.  
  9112.         INPUT
  9113.  
  9114.         Mode - number of video mode
  9115.  
  9116.         OUTPUT
  9117.  
  9118.         no value returned
  9119.  
  9120.         USAGE
  9121.  
  9122.         VIDEOMODESET sets the video mode specified by Mode.  This
  9123.         function is best used at the end of a program to restore the
  9124.         video mode to the mode in use when the program began.  The
  9125.         program should retrieve the video mode at the beginning by
  9126.         using VIDEOMODEGET.
  9127.  
  9128.         SEE ALSO
  9129.  
  9130.         RES320, RES640, RES640L, RES800, RES1024, RES1280, RESTEXT,
  9131.         VIDEOMODEGET
  9132.  
  9133.         EXAMPLE
  9134.  
  9135.         See VIDEOMODEGET
  9136.  
  9137.  
  9138.  
  9139.  
  9140.  
  9141.  
  9142.  
  9143.  
  9144.  
  9145.  
  9146.  
  9147.  
  9148.  
  9149.  
  9150.  
  9151.  
  9152.  
  9153.  
  9154.  
  9155.  
  9156.  
  9157.  
  9158.  
  9159.  
  9160.  
  9161.  
  9162.                                     141
  9163.  
  9164.  
  9165.  
  9166.  
  9167.  
  9168.  
  9169.       VIDEOOFF
  9170.  
  9171.         PROTOTYPE
  9172.  
  9173.         SUB VIDEOOFF ()
  9174.  
  9175.         INPUT
  9176.  
  9177.         no input parameters
  9178.  
  9179.         OUTPUT
  9180.  
  9181.         no value returned
  9182.  
  9183.         USAGE
  9184.  
  9185.         VIDEOOFF turns the output display off.  Graphics may still be
  9186.         drawn to the screen.  However, the computer's monitor will
  9187.         display nothing and appear black.  This function can be used
  9188.         to hide graphics being drawn by initially using VIDEOOFF and
  9189.         then later calling VIDEOON.
  9190.  
  9191.         SEE ALSO
  9192.  
  9193.         VIDEOON
  9194.  
  9195.         EXAMPLE
  9196.  
  9197.         REM DISABLE THE VIDEO FOR ABOUT 3 SEC
  9198.         REM $INCLUDE: 'SVGABC.BI'
  9199.         DEFINT A-Z
  9200.  
  9201.         CLS
  9202.         PRINT "PRESS A KEY TO DISABLE THE VIDEO DISPLAY FOR 3 SECONDS"
  9203.         WHILE INKEY$ = ""
  9204.         WEND
  9205.         VIDEOOFF
  9206.         SDELAY 195
  9207.         VIDEOON
  9208.         PRINT "OK...WE ARE BACK!"
  9209.         WHILE INKEY$ = ""
  9210.         WEND
  9211.         END
  9212.  
  9213.  
  9214.  
  9215.  
  9216.  
  9217.  
  9218.  
  9219.  
  9220.  
  9221.  
  9222.  
  9223.  
  9224.  
  9225.                                     142
  9226.  
  9227.  
  9228.  
  9229.  
  9230.  
  9231.  
  9232.       VIDEOON
  9233.  
  9234.         PROTOTYPE
  9235.  
  9236.         SUB VIDEOON ()
  9237.  
  9238.         INPUT
  9239.  
  9240.         no input parameters
  9241.  
  9242.         OUTPUT
  9243.  
  9244.         no value returned
  9245.  
  9246.         USAGE
  9247.  
  9248.         VIDEOON turns the display back on.  All graphics that were
  9249.         drawn while the display was off are now visible.  This
  9250.         function can be used to hide graphics being drawn by initially
  9251.         using VIDEOOFF and then later calling VIDEOON.
  9252.  
  9253.         SEE ALSO
  9254.  
  9255.         VIDEOOFF
  9256.  
  9257.         EXAMPLE
  9258.  
  9259.         See VIDEOOFF
  9260.  
  9261.  
  9262.  
  9263.  
  9264.  
  9265.  
  9266.  
  9267.  
  9268.  
  9269.  
  9270.  
  9271.  
  9272.  
  9273.  
  9274.  
  9275.  
  9276.  
  9277.  
  9278.  
  9279.  
  9280.  
  9281.  
  9282.  
  9283.  
  9284.  
  9285.  
  9286.  
  9287.  
  9288.                                     143
  9289.  
  9290.  
  9291.  
  9292.  
  9293.  
  9294.  
  9295.       WHICHCPU
  9296.  
  9297.         PROTOTYPE
  9298.  
  9299.         FUNCTION WHICHCPU% ()
  9300.  
  9301.         INPUT
  9302.  
  9303.         no input parameters
  9304.  
  9305.         OUTPUT
  9306.  
  9307.         WHICHCPU returns the processor type.
  9308.  
  9309.         USAGE
  9310.  
  9311.         WHICHCPU returns the computer's processor type as 86, 286, 386
  9312.         or 486.  This function should be called by any program using
  9313.         this library's routines to insure that the computer is at
  9314.         least 386 compatible or better.
  9315.  
  9316.         SEE ALSO
  9317.  
  9318.         WHICHJOYSTICK, WHICHMOUSE, WHICHVGA
  9319.  
  9320.         EXAMPLE
  9321.  
  9322.         REM FIND OUT WHAT KIND OF MICROPROCESSOR WE HAVE
  9323.         REM $INCLUDE: 'SVGABC.BI'
  9324.         DEFINT A-Z
  9325.  
  9326.         CLS
  9327.         CPU = WHICHCPU
  9328.         CPU$ = STR$(CPU)
  9329.         L = LEN(CPU$)
  9330.         CPU$ = RIGHT$(CPU$, L - 1)
  9331.         PRINT "Microprocessor is identified as a 80"; CPU$; "."
  9332.         END
  9333.  
  9334.  
  9335.  
  9336.  
  9337.  
  9338.  
  9339.  
  9340.  
  9341.  
  9342.  
  9343.  
  9344.  
  9345.  
  9346.  
  9347.  
  9348.  
  9349.  
  9350.  
  9351.                                     144
  9352.  
  9353.  
  9354.  
  9355.  
  9356.  
  9357.  
  9358.       WHICHJOYSTICK
  9359.  
  9360.         PROTOTYPE
  9361.  
  9362.         FUNCTION WHICHJOYSTICK% ()
  9363.  
  9364.         INPUT
  9365.  
  9366.         no input parameters
  9367.  
  9368.         OUTPUT
  9369.  
  9370.         WHICHJOYSTICK returns the available joystick support.
  9371.  
  9372.         USAGE
  9373.  
  9374.         WHICHJOYSTICK returns the joystick support available on the
  9375.         computer.  This function should be called prior to use of the
  9376.         joysticks to verify that joysticks are available.  If the
  9377.         function returns a -1, there is no joystick port present or no
  9378.         BIOS support for a joystick.  Joystick A is bit 1 and B is bit
  9379.         2.  Therefore, a return value of 1 means joystick A is
  9380.         available, a value of 2 means B is available and a value of 3
  9381.         means both are available.  If no bits are set, there are no
  9382.         joysticks present.
  9383.  
  9384.         SEE ALSO
  9385.  
  9386.         JOYSTICKINFO, WHICHCPU, WHICHMOUSE, WHICHVGA
  9387.  
  9388.         EXAMPLE
  9389.  
  9390.         REM FIND OUT IF WE HAVE ANY JOYSTICKS AVAILABLE
  9391.         REM $INCLUDE: 'SVGABC.BI'
  9392.         DEFINT A-Z
  9393.  
  9394.         CLS
  9395.         JOYSTICK = WHICHJOYSTICK
  9396.         SELECT CASE JOYSTICK
  9397.            CASE IS = -1
  9398.          A$ = "No joystick port detected or no joystick BIOS
  9399.         support present."
  9400.            CASE IS = 0
  9401.          A$ = "No joystick detected."
  9402.            CASE IS = 1
  9403.          A$ = "Joystick A is present and available."
  9404.            CASE IS = 2
  9405.          A$ = "Joystick B is present and available."
  9406.            CASE IS = 3
  9407.          A$ = "Both Joystick A and Joystick B are present and
  9408.         available."
  9409.         END SELECT
  9410.         PRINT A$
  9411.         END
  9412.  
  9413.  
  9414.                                     145
  9415.  
  9416.  
  9417.  
  9418.  
  9419.  
  9420.  
  9421.       WHICHMEM
  9422.  
  9423.         PROTOTYPE
  9424.  
  9425.         FUNCTION WHICHMEM% ()
  9426.  
  9427.         INPUT
  9428.  
  9429.         no input parameters
  9430.  
  9431.         OUTPUT
  9432.  
  9433.         WHICHMEM returns the installed video memory in kilobytes.
  9434.  
  9435.         USAGE
  9436.  
  9437.         WHICHMEM returns the amount of installed video memory as
  9438.         previously determined by WHICHVGA.  WHICHVGA should be called
  9439.         prior to WHICHMEM.  This function should be called prior to
  9440.         any of the RES### functions to verify that there is enough
  9441.         memory to support the resolution.  If SETCARD was used to set
  9442.         the video card and memory, WHICHMEM will return the amount of
  9443.         memory as defined by SETCARD.
  9444.  
  9445.         SEE ALSO
  9446.  
  9447.         RES320, RES640, RES640L, RES800, RES1024, RES1280, SETCARD,
  9448.         WHICHVGA
  9449.  
  9450.         EXAMPLE
  9451.  
  9452.         REM FIND OUT HOW MUCH VIDEO MEMORY WE HAVE
  9453.         REM $INCLUDE: 'SVGABC.BI'
  9454.         DEFINT A-Z
  9455.  
  9456.         CLS
  9457.         DUMMY = WHICHVGA
  9458.         PRINT "INSTALLED VIDEO MEMORY IS IDENTIFIED AS"; WHICHMEM; "k
  9459.         BYTES"
  9460.         END
  9461.  
  9462.  
  9463.  
  9464.  
  9465.  
  9466.  
  9467.  
  9468.  
  9469.  
  9470.  
  9471.  
  9472.  
  9473.  
  9474.  
  9475.  
  9476.  
  9477.                                     146
  9478.  
  9479.  
  9480.  
  9481.  
  9482.  
  9483.  
  9484.       WHICHMOUSE
  9485.  
  9486.         PROTOTYPE
  9487.  
  9488.         FUNCTION WHICHMOUSE% ()
  9489.  
  9490.         INPUT
  9491.  
  9492.         no input parameters
  9493.  
  9494.         OUTPUT
  9495.  
  9496.         WHICHMOUSE returns the number of buttons on mouse.
  9497.  
  9498.         USAGE
  9499.  
  9500.         WHICHMOUSE returns a value indicating whether a Microsoft
  9501.         compatible mouse is available.  If the function returns 0, no
  9502.         mouse is available.  A non zero value indicates a mouse and
  9503.         Microsoft compatible driver are installed and gives the number
  9504.         of buttons available.
  9505.  
  9506.         SEE ALSO
  9507.  
  9508.         MOUSEINFO, WHICHCPU, WHICHJOYSTICK, WHICHVGA
  9509.  
  9510.         EXAMPLE
  9511.  
  9512.         REM FIND OUT WHAT KIND OF MOUSE WE HAVE
  9513.         REM $INCLUDE: 'SVGABC.BI'
  9514.         DEFINT A-Z
  9515.  
  9516.         CLS
  9517.         MOUSE = WHICHMOUSE
  9518.         IF MOUSE > 0 THEN
  9519.            MOUSEINFO MJV, MNV, TP, I
  9520.            VER$ = STR$(MNV)
  9521.            L = LEN(VER$)
  9522.            VER$ = STR$(MJV) + "." + RIGHT$(VER$, L - 1)
  9523.            VER$ = "Software driver version is" + VER$
  9524.            VER$ = VER$ + " (Microsoft equivalent version)."
  9525.            A$ = "Microsoft compatible mouse detected with"
  9526.            A$ = A$ + STR$(MOUSE) + " buttons on IRQ" + STR$(I) + "."
  9527.            PRINT A$
  9528.            PRINT VER$
  9529.         ELSE
  9530.            PRINT "No Microsoft compatible mouse detected."
  9531.         END IF
  9532.         END
  9533.  
  9534.  
  9535.  
  9536.  
  9537.  
  9538.  
  9539.  
  9540.                                     147
  9541.  
  9542.  
  9543.  
  9544.  
  9545.  
  9546.  
  9547.       WHICHVGA
  9548.  
  9549.         PROTOTYPE
  9550.  
  9551.         FUNCTION WHICHVGA% ()
  9552.  
  9553.         INPUT
  9554.  
  9555.         no input parameters
  9556.  
  9557.         OUTPUT
  9558.  
  9559.         WHICHVGA returns a code identifying the video card.
  9560.  
  9561.         USAGE
  9562.  
  9563.         WHICHVGA identifies the video card installed and the amount of
  9564.         video memory.  In addition this function sets up the default
  9565.         font and mouse cursor.  This function must be called before
  9566.         any other graphics function.  The code returned identifies the
  9567.         video card according to the following table:
  9568.  
  9569.       1  Acumos AVGA2/3 SuperVGA
  9570.       2  ATI Technologies 18/28/38/68800
  9571.          SuperVGA
  9572.       3  Ahead V5000 ver A SuperVGA
  9573.       4  Ahead V5000 ver B SuperVGA
  9574.       5  Chips and Technologies 82C45x SuperVGA
  9575.       6  Cirrus Logic CL-GD 5xx, 6xx, 28xx,
  9576.          54xx, 62xx SuperVGA
  9577.       7  Everex Micro Enhancer Ev236/6xx
  9578.          SuperVGA
  9579.       8  Genoa 61/62/63/64/6600 SuperVGA
  9580.       9  NCR 77C21/22/22E/22E+ SuperVGA
  9581.       10 Oak Technologies OTI-037C/067/077/087
  9582.          SuperVGA
  9583.       11 Paradise/Western Digital PVGA1A,
  9584.          WD90C00/1x/2x/3x SuperVGA
  9585.       12 Realtek RT3106 SuperVGA
  9586.       13 Trident 8800CS, 8900B/C/CL/CX, 90x0
  9587.          SuperVGA
  9588.       14 Tseng Labs ET3000-AX/BX/BP SuperVGA
  9589.       15 Tseng Labs ET4000/W32/W32I SuperVGA
  9590.       16 VESA compatible SuperVGA
  9591.       17 Video 7 HT-208/16 SuperVGA
  9592.       18 Avance Logic AL2101 SuperVGA
  9593.       19 MXIC MX68000/10 SuperVGA
  9594.       20 Primus P2000 SuperVGA
  9595.  
  9596.         Any value returned not found on this table represents an
  9597.         unidentified video card.
  9598.  
  9599.         No graphics functions should be called unless the video card
  9600.         is properly identified.
  9601.  
  9602.  
  9603.                                     148
  9604.  
  9605.  
  9606.  
  9607.  
  9608.  
  9609.  
  9610.  
  9611.         SEE ALSO
  9612.  
  9613.         SETCARD, WHICHCPU, WHICHJOYSTICK, WHICHMOUSE, WHICHMEM
  9614.  
  9615.         EXAMPLE
  9616.  
  9617.         REM FIND OUT WHAT KIND OF VIDEO CARD WE HAVE
  9618.         DEFINT A-Z
  9619.  
  9620.         CLS
  9621.         VGA = WHICHVGA
  9622.         SELECT CASE VGA
  9623.          CASE IS = 1
  9624.             VGA$ = "Acumos AVGA2/3 SuperVGA"
  9625.          CASE IS = 2
  9626.             VGA$ = "ATI Technologies 18/28/38/68800 SuperVGA"
  9627.          CASE IS = 3
  9628.               VGA$ = "Ahead V5000 ver A SuperVGA"
  9629.          CASE IS = 4
  9630.             VGA$ = "Ahead V5000 ver B SuperVGA"
  9631.          CASE IS = 5
  9632.             VGA$ = "Chips and Technologies 82C450/1/2/3/5/6/7
  9633.       SuperVGA"
  9634.          CASE IS = 6
  9635.             VGA$ = "Cirrus Logic CL-GD 5xx,6xx,28xx,54xx,62xx
  9636.       SuperVGA"
  9637.          CASE IS = 7
  9638.             VGA$ = "Everex Ev236/6xx Micro Enhancer SuperVGA"
  9639.          CASE IS = 8
  9640.             VGA$ = "Genoa 61/62/63/64/6600 SuperVGA"
  9641.          CASE IS = 9
  9642.             VGA$ = "NCR 77C21/22/22E/22E+ SuperVGA"
  9643.          CASE IS = 10
  9644.             VGA$ = "Oak Technologies OTI-037C/067/077/087 SuperVGA"
  9645.          CASE IS = 11
  9646.             VGA$ = "Paradise/Western Digital
  9647.       PVGA1A,WD90C00/1x/2x/3x SuperVGA"
  9648.          CASE IS = 12
  9649.             VGA$ = "Realtek RT3106 SuperVGA"
  9650.          CASE IS = 13
  9651.             VGA$ = "Trident 8800CS,8900B/C/CL/CX,90x0 SuperVGA"
  9652.          CASE IS = 14
  9653.             VGA$ = "Tseng Labs ET3000-AX/BX/BP SuperVGA"
  9654.          CASE IS = 15
  9655.             VGA$ = "Tseng Labs ET4000/W32/W32I SuperVGA"
  9656.          CASE IS = 16
  9657.             VGA$ = "VESA compatible SuperVGA"
  9658.          CASE IS = 17
  9659.             VGA$ = "Video 7 HT-208/16 SuperVGA"
  9660.          CASE IS = 18
  9661.             VGA$ = "Avance Logic AL2101 SuperVGA"
  9662.          CASE IS = 19
  9663.             VGA$ = "MXIC MX68000/10 SuperVGA"
  9664.  
  9665.  
  9666.                                     149
  9667.  
  9668.  
  9669.  
  9670.  
  9671.  
  9672.  
  9673.          CASE IS = 20
  9674.             VGA$ = "Primus P2000 SuperVGA"
  9675.          CASE ELSE
  9676.             VGA$ = "Unknown"
  9677.             VGA = 0
  9678.         END SELECT
  9679.         PRINT "Video card/chip is identified as a "; VGA$; "."
  9680.         END
  9681.  
  9682.  
  9683.  
  9684.  
  9685.  
  9686.  
  9687.  
  9688.  
  9689.  
  9690.  
  9691.  
  9692.  
  9693.  
  9694.  
  9695.  
  9696.  
  9697.  
  9698.  
  9699.  
  9700.  
  9701.  
  9702.  
  9703.  
  9704.  
  9705.  
  9706.  
  9707.  
  9708.  
  9709.  
  9710.  
  9711.  
  9712.  
  9713.  
  9714.  
  9715.  
  9716.  
  9717.  
  9718.  
  9719.  
  9720.  
  9721.  
  9722.  
  9723.  
  9724.  
  9725.  
  9726.  
  9727.  
  9728.  
  9729.                                     150
  9730.  
  9731.  
  9732.  
  9733.  
  9734.  
  9735.  
  9736.       WHICHXMS
  9737.  
  9738.         PROTOTYPE
  9739.  
  9740.         FUNCTION WHICHXMS% (XmsKBytesAvailable%, XmsHandlesAvailable%)
  9741.  
  9742.         INPUT
  9743.  
  9744.         no input parameters
  9745.  
  9746.         OUTPUT
  9747.  
  9748.         WHICHXMS returns a 1 if extended memory support is detected, 0
  9749.         otherwise.
  9750.         XmsKBytesAvailable - number of free kilobytes in extended
  9751.         memory
  9752.         XmsHandlesAvailable - number of available free handles
  9753.  
  9754.         USAGE
  9755.  
  9756.         WHICHXMS detects the existence of extended memory support and
  9757.         sets up the library function calls.  This function must be
  9758.         called before any other extended memory functions.  WHICHXMS
  9759.         also returns the number of free kilobytes of extended memory
  9760.         and the number of available handles.  The number of available
  9761.         handles is limited, normally to 32.  This limit can be
  9762.         modified by changing the extended memory driver (Microsoft's
  9763.         HIMEM.SYS is the most common) command line in the CONFIG.SYS
  9764.         file.
  9765.  
  9766.         SEE ALSO
  9767.  
  9768.         XMSALLOCATE, XMSCOPY, XMSERROR, XMSFREE, XMSGET, XMSPUT
  9769.  
  9770.         EXAMPLE
  9771.  
  9772.         REM THIS WILL SHOW IF XMS MEMORY IS AVAILABLE AND HOW MUCH
  9773.         REM $INCLUDE: 'SVGABC.BI'
  9774.         DEFINT A-Z
  9775.         IF WHICHXMS(MEM, HANDLES) = 1 THEN
  9776.            PRINT "AN XMS MEMORY MANAGER IS INSTALLED (SUCH AS
  9777.         'HIMEM.SYS')"
  9778.            IF MEM > 0 THEN
  9779.          TOTMEM& = 1024
  9780.          TOTMEM& = TOTMEM& * MEM
  9781.          PRINT "A TOTAL OF"; TOTMEM&; "BYTES ARE AVAILABLE"
  9782.          IF HANDLES > 0 THEN
  9783.             PRINT "A TOTAL OF"; HANDLES; "HANDLES(S) ARE AVAILABLE"
  9784.             PRINT "XMS MEMORY IS READY FOR USE"
  9785.          ELSE
  9786.             PRINT "SORRY...ALL XMS HANDLES ARE BEING USED"
  9787.             PRINT "CHANGE (OR ADD) THE '/numhandles' SWITCH ON YOUR
  9788.         XMS MEMORY MANAGER"
  9789.          END IF
  9790.  
  9791.  
  9792.                                     151
  9793.  
  9794.  
  9795.  
  9796.  
  9797.  
  9798.  
  9799.            ELSE
  9800.          PRINT "SORRY...ALL XMS MEMORY IS ALLOCATED"
  9801.            END IF
  9802.         ELSE
  9803.            PRINT "SORRY...NO ACTIVE XMS MEMORY MANAGER FOUND"
  9804.            PRINT "MAKE SURE YOU HAVE AN XMS MEMORY MANAGER (SUCH AS
  9805.         'HIMEM.SYS' INSTALLED)"
  9806.         END IF
  9807.         END
  9808.  
  9809.  
  9810.  
  9811.  
  9812.  
  9813.  
  9814.  
  9815.  
  9816.  
  9817.  
  9818.  
  9819.  
  9820.  
  9821.  
  9822.  
  9823.  
  9824.  
  9825.  
  9826.  
  9827.  
  9828.  
  9829.  
  9830.  
  9831.  
  9832.  
  9833.  
  9834.  
  9835.  
  9836.  
  9837.  
  9838.  
  9839.  
  9840.  
  9841.  
  9842.  
  9843.  
  9844.  
  9845.  
  9846.  
  9847.  
  9848.  
  9849.  
  9850.  
  9851.  
  9852.  
  9853.  
  9854.  
  9855.                                     152
  9856.  
  9857.  
  9858.  
  9859.  
  9860.  
  9861.  
  9862.       XMSALLOCATE
  9863.  
  9864.         PROTOTYPE
  9865.  
  9866.         FUNCTION XMSALLOCATE% (RequestedKBytes%)
  9867.  
  9868.         INPUT
  9869.  
  9870.         RequestedKBytes - requested number of kilobytes of extended
  9871.         memory
  9872.  
  9873.         OUTPUT
  9874.  
  9875.         XMSALLOCATE returns the assigned memory handle if the
  9876.         allocation is successful, 0 otherwise.
  9877.  
  9878.         USAGE
  9879.  
  9880.         XMSALLOCATE attempts to allocate the requested number of
  9881.         kilobytes in extended memory.  If successful, the function
  9882.         returns the handle of the new memory block.  If the function
  9883.         returns zero, then the allocation was unsuccessful; check
  9884.         XMSERROR for error codes.
  9885.  
  9886.         All allocated blocks must be freed using XMSFREE before a
  9887.         program terminates or the memory is lost until the machine is
  9888.         rebooted.  Simply exiting a program will not free allocated
  9889.         extended memory blocks.
  9890.  
  9891.         SEE ALSO
  9892.  
  9893.         WHICHXMS, XMSCOPY, XMSERROR, XMSFREE, XMSGET, XMSPUT
  9894.  
  9895.         EXAMPLE
  9896.  
  9897.         See XMSCOPY
  9898.  
  9899.  
  9900.  
  9901.  
  9902.  
  9903.  
  9904.  
  9905.  
  9906.  
  9907.  
  9908.  
  9909.  
  9910.  
  9911.  
  9912.  
  9913.  
  9914.  
  9915.  
  9916.  
  9917.  
  9918.                                     153
  9919.  
  9920.  
  9921.  
  9922.  
  9923.  
  9924.  
  9925.       XMSCOPY
  9926.  
  9927.         PROTOTYPE
  9928.  
  9929.         FUNCTION XMSCOPY% (SrcXmsHandle%, SrcOffset&, DestXmsHandle%,
  9930.         DestOffset&, NumBytes&)
  9931.  
  9932.         INPUT
  9933.  
  9934.         SrcXmsHandle - handle of source extended memory block
  9935.         SrcOffset - number of bytes from beginning of source memory
  9936.         block
  9937.         DestXmsHandle - handle of destination extended memory block
  9938.         DestOffset - number of bytes from beginning of destination
  9939.         memory block
  9940.         NumBytes - number of bytes to copy from source to destination
  9941.         (must be even)
  9942.  
  9943.         OUTPUT
  9944.  
  9945.         XMSCOPY returns a 1 if copy was successful, 0 otherwise.
  9946.  
  9947.         USAGE
  9948.  
  9949.         XMSCOPY copies the number of bytes specified in NumBytes from
  9950.         the source extended memory block to the destination extended
  9951.         memory block.  NumBytes must be an even number.  The copy may
  9952.         begin and/or end offset from the beginning of the source and
  9953.         destination blocks by passing non zero values in SrcOffset
  9954.         and/or DestOffset.  The copy will occur faster if both offsets
  9955.         are divisible by four.  If the copy was unsuccessful, check
  9956.         XMSERROR for error codes.
  9957.  
  9958.         SEE ALSO
  9959.  
  9960.         WHICHXMS, XMSALLOCATE, XMSERROR, XMSFREE, XMSGET, XMSPUT
  9961.  
  9962.         EXAMPLE
  9963.  
  9964.         REM THIS WILL COPY ONE ARRAY INTO ONE XMS BLOCK AND THEN COPY
  9965.         IT
  9966.         REM TO A DIFFERENT XMS BLOCK, AND THEN COPY THAT BACK INTO
  9967.         ANOTHER ARRAY
  9968.         REM $INCLUDE: 'SVGABC.BI'
  9969.         DEFINT A-Z
  9970.  
  9971.         REM *DIMENSION OUR SOURCE AND DESTINATION ARRAYS*
  9972.         DIM TEST1(0 TO 9) AS INTEGER
  9973.         DIM TEST2(0 TO 9) AS INTEGER
  9974.         CLS
  9975.  
  9976.         REM *MAKE SURE XMS IS READY AND AVAILBLE*
  9977.         IF WHICHXMS(MEM, HANDLES) = 1 THEN
  9978.            IF MEM < 1 OR HANDLES < 1 THEN
  9979.  
  9980.  
  9981.                                     154
  9982.  
  9983.  
  9984.  
  9985.  
  9986.  
  9987.  
  9988.          PRINT "SORRY...THERE IS EITHER NO FREE XMS MEMORY OR NO
  9989.         FREE XMS HANDLES"
  9990.          END
  9991.            END IF
  9992.         ELSE
  9993.            PRINT "SORRY...NO ACTIVE XMS MEMORY MANAGER FOUND"
  9994.            PRINT "MAKE SURE YOU HAVE A XMS MEMORY MANAGER (SUCH AS
  9995.         'HIMEM.SYS' INSTALLED)"
  9996.            END
  9997.         END IF
  9998.  
  9999.         REM *PUT SOME DATA INTO THE SOURCE ARRAY*
  10000.         FOR I = 0 TO 9
  10001.            TEST1(I) = I * 10
  10002.         NEXT I
  10003.  
  10004.         REM *ALLOCATE THE FIRST XMS MEMORY BLOCK*
  10005.         OurHandle1 = XMSALLOCATE(1)
  10006.         IF OurHandle1 = 0 THEN
  10007.            PRINT "OPPS..THERE IS SOME ERROR...UNABLE TO ALLOCATE XMS"
  10008.            PRINT "ERROR #"; XMSERROR
  10009.            ER = XMSFREE(OurHandle1)
  10010.            END
  10011.         END IF
  10012.  
  10013.         REM *ALLOCATE THE SECOND XMS MEMORY BLOCK*
  10014.         OurHandle2 = XMSALLOCATE(1)
  10015.         IF OurHandle2 = 0 THEN
  10016.            PRINT "OPPS..THERE IS SOME ERROR...UNABLE TO ALLOCATE XMS"
  10017.            PRINT "ERROR #"; XMSERROR
  10018.            ER = XMSFREE(OurHandle1)
  10019.            ER = XMSFREE(OurHandle2)
  10020.            END
  10021.         END IF
  10022.  
  10023.         REM *COPY OUR SOURCE ARRAY INTO OUR FIRST XMS BLOCK*
  10024.         I = XMSPUT(TEST1(0), OurHandle1, 0, 20)
  10025.         IF I = 0 THEN
  10026.            PRINT "OPPS..THERE IS SOME ERROR...SEE THE ERROR CODE
  10027.         LIST..."
  10028.            PRINT "ERROR #"; XMSERROR
  10029.            ER = XMSFREE(OurHandle1)
  10030.            ER = XMSFREE(OurHandle2)
  10031.            END
  10032.         END IF
  10033.  
  10034.         REM *COPY THE FIRST XMS BLOCK TO THE SECOND XMS BLOCK*
  10035.         IF XMSCOPY(OurHandle1, 0, OurHandle2, 0, 20) = 0 THEN
  10036.            PRINT "OPPS..THERE IS SOME ERROR...SEE THE ERROR CODE
  10037.         LIST..."
  10038.            PRINT "ERROR #"; XMSERROR
  10039.            ER = XMSFREE(OurHandle1)
  10040.            ER = XMSFREE(OurHandle2)
  10041.            END
  10042.  
  10043.  
  10044.                                     155
  10045.  
  10046.  
  10047.  
  10048.  
  10049.  
  10050.  
  10051.         END IF
  10052.  
  10053.         REM *COPY DATA FROM THE SECOND XMS BLOCK TO OUR DESTINATION
  10054.         ARRAY*
  10055.         IF XMSGET(OurHandle2, 0, TEST2(0), 20) = 0 THEN
  10056.            PRINT "OPPS..THERE IS SOME ERROR...SEE THE ERROR CODE
  10057.         LIST..."
  10058.            PRINT "ERROR #"; ER
  10059.            ER = XMSFREE(OurHandle1)
  10060.            ER = XMSFREE(OurHandle2)
  10061.            END
  10062.         END IF
  10063.  
  10064.         REM *FREE THE XMS BLOCKS WE HAVE ALLOCATED*
  10065.         ER = XMSFREE(OurHandle1)
  10066.         ER = XMSFREE(OurHandle2)
  10067.  
  10068.         REM *SHOW THE RESULTS*
  10069.         PRINT "OK...WE INITILIZED ONE ARRAY,PUT A COPY OF IT INTO
  10070.         XMS,"
  10071.         PRINT "THEN WE COPIED THAT XMS BLOCK TO ANOTHER XMS BLOCK,
  10072.         AND"
  10073.         PRINT "THEN PUT A COPY OF THE SECOND XMS BLOCK INTO A NEW
  10074.         ARRAY;"
  10075.         PRINT "HERE ARE THE RESULTS:"
  10076.         PRINT
  10077.         PRINT "SOURCE ARRAY", , "DESTINATION ARRAY"
  10078.         FOR I = 0 TO 9
  10079.            PRINT TEST1(I), , TEST2(I)
  10080.         NEXT I
  10081.         END
  10082.  
  10083.  
  10084.  
  10085.  
  10086.  
  10087.  
  10088.  
  10089.  
  10090.  
  10091.  
  10092.  
  10093.  
  10094.  
  10095.  
  10096.  
  10097.  
  10098.  
  10099.  
  10100.  
  10101.  
  10102.  
  10103.  
  10104.  
  10105.  
  10106.  
  10107.                                     156
  10108.  
  10109.  
  10110.  
  10111.  
  10112.  
  10113.  
  10114.       XMSERROR
  10115.  
  10116.         PROTOTYPE
  10117.  
  10118.         FUNCTION XMSERROR% ()
  10119.  
  10120.         INPUT
  10121.  
  10122.         no input parameters
  10123.  
  10124.         OUTPUT
  10125.  
  10126.         XMSERROR returns the error code from the most recent XMS
  10127.         function call.
  10128.  
  10129.         USAGE
  10130.  
  10131.         XMSERROR returns the error code from the most recent XMS
  10132.         function call.  Each XMS function resets the error code to
  10133.         zero.  Therefore, if there has been an error, the error code
  10134.         should be checked immediately.  The error code will be one of
  10135.         the following:
  10136.  
  10137.         0    no error
  10138.         1    WHICHXMS has not been
  10139.          called
  10140.         2    number of bytes to
  10141.          copy is zero
  10142.         3    number of bytes to
  10143.          copy is odd
  10144.         4    offset into XMS block
  10145.          is zero
  10146.         128  Function not
  10147.          implemented
  10148.         129  VDISK device driver
  10149.          was detected
  10150.         142  General driver error
  10151.         143  Unrecoverable driver
  10152.          error
  10153.         146  DX is less than
  10154.          /HMAMIN= parameter
  10155.         160  All extended memory is
  10156.          allocated
  10157.         161  XMM handles are
  10158.          exhausted
  10159.         162  Handle is invalid
  10160.         163  Source handle is
  10161.          invalid
  10162.         164  Source offset is
  10163.          invalid
  10164.         165  Destination handle is
  10165.          invalid
  10166.         166  Destination offset is
  10167.          invalid
  10168.  
  10169.  
  10170.                                     157
  10171.  
  10172.  
  10173.  
  10174.  
  10175.  
  10176.  
  10177.         167  Length is invalid
  10178.         168  Overlap in move
  10179.          request is invalid
  10180.         169  Parity error detected
  10181.         171  Block locked
  10182.  
  10183.         SEE ALSO
  10184.  
  10185.         WHICHXMS, XMSALLOCATE, XMSCOPY, XMSFREE, XMSGET, XMSPUT
  10186.  
  10187.         EXAMPLE
  10188.  
  10189.         See XMSCOPY
  10190.  
  10191.  
  10192.  
  10193.  
  10194.  
  10195.  
  10196.  
  10197.  
  10198.  
  10199.  
  10200.  
  10201.  
  10202.  
  10203.  
  10204.  
  10205.  
  10206.  
  10207.  
  10208.  
  10209.  
  10210.  
  10211.  
  10212.  
  10213.  
  10214.  
  10215.  
  10216.  
  10217.  
  10218.  
  10219.  
  10220.  
  10221.  
  10222.  
  10223.  
  10224.  
  10225.  
  10226.  
  10227.  
  10228.  
  10229.  
  10230.  
  10231.  
  10232.  
  10233.                                     158
  10234.  
  10235.  
  10236.  
  10237.  
  10238.  
  10239.  
  10240.       XMSFREE
  10241.  
  10242.         PROTOTYPE
  10243.  
  10244.         FUNCTION XMSFREE% (XmsHandle%)
  10245.  
  10246.         INPUT
  10247.  
  10248.         XmsHandle - handle of extended memory block to free
  10249.  
  10250.         OUTPUT
  10251.  
  10252.         XMSFREE returns 1 if extended memory block was deallocated, 0
  10253.         otherwise.
  10254.  
  10255.         USAGE
  10256.  
  10257.         XMSFREE deallocates the specified extended memory block.  All
  10258.         allocated blocks must be freed before a program terminates or
  10259.         the memory is lost until the machine is rebooted.  Simply
  10260.         exiting a program will not free allocated extended memory
  10261.         blocks.  If the function was unsuccessful, check XMSERROR for
  10262.         error codes.
  10263.  
  10264.         SEE ALSO
  10265.  
  10266.         WHICHXMS, XMSALLOCATE, XMSCOPY, XMSERROR, XMSGET, XMSPUT
  10267.  
  10268.         EXAMPLE
  10269.  
  10270.         See XMSCOPY
  10271.  
  10272.  
  10273.  
  10274.  
  10275.  
  10276.  
  10277.  
  10278.  
  10279.  
  10280.  
  10281.  
  10282.  
  10283.  
  10284.  
  10285.  
  10286.  
  10287.  
  10288.  
  10289.  
  10290.  
  10291.  
  10292.  
  10293.  
  10294.  
  10295.  
  10296.                                     159
  10297.  
  10298.  
  10299.  
  10300.  
  10301.  
  10302.  
  10303.       XMSGET
  10304.  
  10305.         PROTOTYPE
  10306.  
  10307.         FUNCTION XMSGET% (SrcXmsHandle%, SrcOffset&, DestVariable%,
  10308.         NumBytes&)
  10309.  
  10310.         INPUT
  10311.  
  10312.         SrcXmsHandle - handle of source extended memory block
  10313.         SrcOffset - number of bytes from beginning of source memory
  10314.         block
  10315.         NumBytes - number of bytes to copy from extended memory to
  10316.         conventional memory (must be even)
  10317.  
  10318.         OUTPUT
  10319.  
  10320.         XMSGET returns 0 if the copy was successful, an error code
  10321.         otherwise.
  10322.         DestVariable - integer variable or array holding copied data
  10323.  
  10324.         USAGE
  10325.  
  10326.         XMSGET retrieves data from extended memory and places it in
  10327.         conventional memory.  The number of bytes copied must be an
  10328.         even number and cannot be larger than 65536.  The copy may
  10329.         begin off the beginning of the source extended memory block by
  10330.         specifying a non zero SrcOffset.  If the function was
  10331.         unsuccessful, check XMSERROR for error codes.
  10332.  
  10333.         SEE ALSO
  10334.  
  10335.         WHICHXMS, XMSALLOCATE, XMSCOPY, XMSERROR, XMSFREE, XMSPUT
  10336.  
  10337.         EXAMPLE
  10338.  
  10339.         See XMSCOPY
  10340.  
  10341.  
  10342.  
  10343.  
  10344.  
  10345.  
  10346.  
  10347.  
  10348.  
  10349.  
  10350.  
  10351.  
  10352.  
  10353.  
  10354.  
  10355.  
  10356.  
  10357.  
  10358.  
  10359.                                     160
  10360.  
  10361.  
  10362.  
  10363.  
  10364.  
  10365.  
  10366.       XMSPUT
  10367.  
  10368.         PROTOTYPE
  10369.  
  10370.         FUNCTION XMSPUT% (SrcVariable%, DestXmsHandle%, DestOffset&,
  10371.         NumBytes&)
  10372.  
  10373.         INPUT
  10374.  
  10375.         SrcVariable - source variable or array in conventional memory
  10376.         DestXmsHandle - handle of destination extended memory block
  10377.         DestOffset - number of bytes from beginning of destination
  10378.         memory block
  10379.         NumBytes - number of bytes to copy from conventional memory to
  10380.         extended memory (must be even)
  10381.  
  10382.         OUTPUT
  10383.  
  10384.         XMSPUT returns 1 if the copy was successful, 0 otherwise.
  10385.  
  10386.         USAGE
  10387.  
  10388.         XMSPUT copies data from conventional memory to extended
  10389.         memory.  The number of bytes copied must be an even number and
  10390.         cannot be larger than 65536.  The destination may begin off
  10391.         the beginning of the extended memory block by specifying a non
  10392.         zero DestOffset.  If the function was unsuccessful, check
  10393.         XMSERROR for error codes.
  10394.  
  10395.         SEE ALSO
  10396.  
  10397.         WHICHXMS, XMSALLOCATE, XMSCOPY, XMSERROR, XMSFREE, XMSGET
  10398.  
  10399.         EXAMPLE
  10400.  
  10401.         See XMSCOPY
  10402.  
  10403.  
  10404.  
  10405.  
  10406.  
  10407.  
  10408.  
  10409.  
  10410.  
  10411.  
  10412.  
  10413.  
  10414.  
  10415.  
  10416.  
  10417.  
  10418.  
  10419.  
  10420.  
  10421.  
  10422.                                     161
  10423.  
  10424.  
  10425.  
  10426.  
  10427.  
  10428.  
  10429.       APPENDIX A.  SVGABC.BI
  10430.  
  10431.       This is the header file containing function declarations and
  10432.       structure definitions for SVGAQB.LIB and SVGAPV.LIB.  This file
  10433.       should be included in every program that uses this library.  To
  10434.       properly include the header file, place the following line at the
  10435.       top of the every program module:
  10436.  
  10437.                   REM $INCLUDE: 'SVGABC.BI'
  10438.  
  10439.       Without these declarations and definitions, the QuickBasic
  10440.       compiler will be unable to compile any program using the commands
  10441.       found in this library.
  10442.  
  10443.         REM SVGAQB,SVGAPV GRAPHICS LIBRARY INCLUDE FILE FOR MS
  10444.            QuickBasic 4.x,
  10445.         REM MS PDS and MS VBDOS
  10446.         REM COPYRIGHT 1993-1994 BY STEPHEN L. BALKUM AND DANIEL A.
  10447.            SILL
  10448.         REM ZEPHYR SOFTWARE P.O. BOX 7704, AUSTIN, TEXAS  78713-7704
  10449.         REM LAST UPDATE 5/1/94
  10450.  
  10451.         TYPE P2DType
  10452.            X AS INTEGER
  10453.            Y AS INTEGER
  10454.         END TYPE
  10455.  
  10456.         TYPE P3Dtype
  10457.            X AS INTEGER
  10458.            Y AS INTEGER
  10459.            Z AS INTEGER
  10460.         END TYPE
  10461.  
  10462.         TYPE PROJType
  10463.            EYEX AS INTEGER
  10464.            EYEY AS INTEGER
  10465.            EYEZ AS INTEGER
  10466.            SCRD AS INTEGER
  10467.            THETA AS INTEGER
  10468.            PHI AS INTEGER
  10469.         END TYPE
  10470.  
  10471.         DECLARE SUB BLKGET (BYVAL X1%, BYVAL Y1%, BYVAL X2%, BYVAL
  10472.            Y2%, SEG GfxBlk%)
  10473.         DECLARE SUB BLKPUT (BYVAL Mode%, BYVAL X%, BYVAL Y%, SEG
  10474.            GfxBlk%)
  10475.         DECLARE SUB BLKRESIZE (BYVAL X%, BYVAL Y%, SEG SourceGfxBlk%,
  10476.            SEG DestGfxBlk%)
  10477.         DECLARE FUNCTION BLKROTATE% (BYVAL Ang%, BYVAL BackFill%, SEG
  10478.            SourceGfxBlk%, SEG DestGfxBlk%)
  10479.         DECLARE FUNCTION BLKROTATESIZE& (BYVAL Ang%, SEG
  10480.            SourceGfxBlk%)
  10481.         DECLARE SUB BYTECOPY (SEG SourceArray%, SEG DestArray%, BYVAL
  10482.            NumOfBytes&)
  10483.  
  10484.  
  10485.                                     162
  10486.  
  10487.  
  10488.  
  10489.  
  10490.  
  10491.  
  10492.         DECLARE SUB D2ROTATE (BYVAL Points%, BYVAL XOrigin%, BYVAL
  10493.            YOrigin%, BYVAL Ang%, SEG InAry%, SEG OutAry%)
  10494.         DECLARE SUB D2SCALE (BYVAL Points%, BYVAL XSCALE%, BYVAL
  10495.            YSCALE%, SEG InAry%, SEG OutAry%)
  10496.         DECLARE SUB D2TRANSLATE (BYVAL Points%, BYVAL XTRANS%, BYVAL
  10497.            YTRANS%, SEG InAry%, SEG OutAry%)
  10498.         DECLARE FUNCTION D3PROJECT% (BYVAL Points%, SEG ProjParms%,
  10499.            SEG InAry%, SEG OutAry%)
  10500.         DECLARE SUB D3ROTATE (BYVAL Points%, BYVAL XOrigin%, BYVAL
  10501.            YOrigin%, BYVAL ZOrigin%, BYVAL ZRAng%, BYVAL YRAng%, BYVAL
  10502.            XRAng%, SEG InAry%, SEG OutAry%)
  10503.         DECLARE SUB D3SCALE (BYVAL Points%, BYVAL XSCALE%, BYVAL
  10504.            YSCALE%, BYVAL ZScale%, SEG InAry%, SEG OutAry%)
  10505.         DECLARE SUB D3TRANSLATE (BYVAL Points%, BYVAL XTRANS%, BYVAL
  10506.            YTRANS%, BYVAL ZTrans%, SEG InAry%, SEG OutAry%)
  10507.         DECLARE SUB DRWBOX (BYVAL Mode%, BYVAL Colr%, BYVAL X1%, BYVAL
  10508.            Y1%, BYVAL X2%, BYVAL Y2%)
  10509.         DECLARE SUB DRWCIRCLE (BYVAL Mode%, BYVAL Colr%, BYVAL
  10510.            CenterX%, BYVAL CenterY%, BYVAL Radius%)
  10511.         DECLARE SUB DRWELLIPSE (BYVAL Mode%, BYVAL Colr%, BYVAL
  10512.            CenterX%, BYVAL CenterY%, BYVAL Radiusx%, BYVAL Radiusy%)
  10513.         DECLARE SUB DRWFILLBOX (BYVAL Mode%, BYVAL Colr%, BYVAL X1%,
  10514.            BYVAL Y1%, BYVAL X2%, BYVAL Y2%)
  10515.         DECLARE SUB DRWFILLCIRCLE (BYVAL Mode%, BYVAL Colr%, BYVAL
  10516.            CenterX%, BYVAL CenterY%, BYVAL Radius%)
  10517.         DECLARE SUB DRWFILLELLIPSE (BYVAL Mode%, BYVAL Colr%, BYVAL
  10518.            CenterX%, BYVAL CenterY%, BYVAL Radiusx%, BYVAL Radiusy%)
  10519.         DECLARE SUB DRWLINE (BYVAL Mode%, BYVAL Colr%, BYVAL X1%,
  10520.            BYVAL Y1%, BYVAL X2%, BYVAL Y2%)
  10521.         DECLARE SUB DRWPOINT (BYVAL Mode%, BYVAL Colr%, BYVAL X%,
  10522.            BYVAL Y%)
  10523.         DECLARE SUB DRWSTRING (BYVAL Mode%, BYVAL FColr%, BYVAL
  10524.            BColr%, Strng$, BYVAL X%, BYVAL Y%)
  10525.         DECLARE SUB DRWSTRINGDN (BYVAL Mode%, BYVAL FColr%, BYVAL
  10526.            BColr%, Strng$, BYVAL X%, BYVAL Y%)
  10527.         DECLARE SUB DRWSTRINGLT (BYVAL Mode%, BYVAL FColr%, BYVAL
  10528.            BColr%, Strng$, BYVAL X%, BYVAL Y%)
  10529.         DECLARE SUB DRWSTRINGRT (BYVAL Mode%, BYVAL FColr%, BYVAL
  10530.            BColr%, Strng$, BYVAL X%, BYVAL Y%)
  10531.         DECLARE SUB FILLAREA (BYVAL Xseed%, BYVAL Yseed%, BYVAL
  10532.            BorderColr%, BYVAL FillColr%)
  10533.         DECLARE SUB FILLCOLOR (BYVAL Xseed%, BYVAL Yseed%, BYVAL
  10534.            OldColr%, BYVAL NewColr%)
  10535.         DECLARE SUB FILLCONVEXPOLY (BYVAL Colr%, BYVAL Points%, SEG
  10536.            InAry%)
  10537.         DECLARE SUB FILLSCREEN (BYVAL Colr%)
  10538.         DECLARE SUB FILLPAGE (BYVAL Colr%)
  10539.         DECLARE SUB FILLVIEW (BYVAL Colr%)
  10540.         DECLARE SUB FONTGETINFO (SEG WDTH%, SEG HGHT%)
  10541.         DECLARE SUB FONTSET (FONT$)
  10542.         DECLARE SUB FONTSYSTEM ()
  10543.         DECLARE FUNCTION GETARCCOS% (BYVAL Value&)
  10544.         DECLARE FUNCTION GETARCSIN% (BYVAL Value&)
  10545.         DECLARE FUNCTION GETARCTAN% (BYVAL Value&)
  10546.  
  10547.  
  10548.                                     163
  10549.  
  10550.  
  10551.  
  10552.  
  10553.  
  10554.  
  10555.         DECLARE FUNCTION GETCOS& (BYVAL Ang&)
  10556.         DECLARE FUNCTION GETSIN& (BYVAL Ang&)
  10557.         DECLARE FUNCTION GETTAN& (BYVAL Ang&)
  10558.         DECLARE FUNCTION GETSQRT& (BYVAL Number&)
  10559.         DECLARE FUNCTION GETMAXX% ()
  10560.         DECLARE FUNCTION GETMAXY% ()
  10561.         DECLARE SUB GETLASTSTRING (SEG StrngGfxBlk%)
  10562.         DECLARE FUNCTION GETPOINT% (BYVAL X%, BYVAL Y%)
  10563.         DECLARE FUNCTION GIFMAKE% (BYVAL X1%, BYVAL Y1%, BYVAL X2%,
  10564.            BYVAL Y2%, FileName$)
  10565.         DECLARE FUNCTION GIFGETINFO% (FileName$, SEG GifXSize%, SEG
  10566.            GifYSize%, SEG NumColors%, Pal$)
  10567.         DECLARE FUNCTION GIFPUT% (BYVAL Mode%, BYVAL Xloc%, BYVAL
  10568.            Yloc%, Name$)
  10569.         DECLARE SUB JOYSTICKINFO (SEG JAX%, SEG JAY%, SEG JAButs%, SEG
  10570.            JBX%, SEG JBY%, SEG JBButs%)
  10571.         DECLARE SUB MOUSEBUTPRESS (BYVAL ReqBut%, SEG Xloc%, SEG
  10572.            Yloc%, SEG Num%, SEG MButs%)
  10573.         DECLARE SUB MOUSEBUTRELEASE (BYVAL ReqBut%, SEG Xloc%, SEG
  10574.            Yloc%, SEG Num%, SEG MButs%)
  10575.         DECLARE SUB MOUSECURSORDEFAULT ()
  10576.         DECLARE SUB MOUSECURSORSET (MouseCursor$)
  10577.         DECLARE SUB MOUSEENTER ()
  10578.         DECLARE SUB MOUSEEXIT ()
  10579.         DECLARE SUB MOUSEHIDE ()
  10580.         DECLARE SUB MOUSEINFO (SEG DrvMajorVer%, SEG DrvMinorVer%, SEG
  10581.            MouseType%, SEG IRQnumber%)
  10582.         DECLARE SUB MOUSELOCSET (BYVAL Xloc%, BYVAL Yloc%)
  10583.         DECLARE SUB MOUSERANGESET (BYVAL X1%, BYVAL Y1%, BYVAL X2%,
  10584.            BYVAL Y2%)
  10585.         DECLARE SUB MOUSERESTORESTATE (SEG MouseBuf%)
  10586.         DECLARE SUB MOUSESAVESTATE (SEG MouseBuf%)
  10587.         DECLARE SUB MOUSESENSSET (BYVAL Xsens%, BYVAL Ysens%)
  10588.         DECLARE SUB MOUSESHOW ()
  10589.         DECLARE SUB MOUSESTATUS (SEG X%, SEG Y%, SEG MButs%)
  10590.         DECLARE FUNCTION MOUSESTORAGESIZE% ()
  10591.         DECLARE SUB OVERSCANSET (BYVAL Colr%)
  10592.         DECLARE FUNCTION PAGEDISPLAY% (BYVAL X%, BYVAL Y%, BYVAL
  10593.            Page%)
  10594.         DECLARE FUNCTION PAGEACTIVE% (BYVAL Page%)
  10595.         DECLARE SUB PALCHGAUTO (PalString$, NewPalString$, BYVAL
  10596.            FirstColr%, BYVAL LastColr%, BYVAL Speed%)
  10597.         DECLARE SUB PALCHGSTEP (PalString$, NewPalString$, BYVAL
  10598.            FirstColr%, BYVAL LastColr%, BYVAL Percent%)
  10599.         DECLARE SUB PALCOPY (SourcePalString$, DestPalString$, BYVAL
  10600.            FirstColr%, BYVAL LastColr%)
  10601.         DECLARE SUB PALDIMSTEP (PalString$, BYVAL FirstColr%, BYVAL
  10602.            LastColr%, BYVAL Percent%)
  10603.         DECLARE SUB PALGET (PalString$, BYVAL FirstColr%, BYVAL
  10604.            LastColr%)
  10605.         DECLARE SUB PALIOAUTO (PalString$, BYVAL FirstColr%, BYVAL
  10606.            LastColr%, BYVAL Speed%)
  10607.         DECLARE SUB PALROTATE (PalString$, BYVAL FirstColr%, BYVAL
  10608.            LastColr%, BYVAL Shift%)
  10609.  
  10610.  
  10611.                                     164
  10612.  
  10613.  
  10614.  
  10615.  
  10616.  
  10617.  
  10618.         DECLARE SUB PALSET (PalString$, BYVAL FirstColr%, BYVAL
  10619.            LastColr%)
  10620.         DECLARE FUNCTION RES320% ()
  10621.         DECLARE FUNCTION RES640L% ()
  10622.         DECLARE FUNCTION RES640% ()
  10623.         DECLARE FUNCTION RES800% ()
  10624.         DECLARE FUNCTION RES1024% ()
  10625.         DECLARE FUNCTION RES1280% ()
  10626.         DECLARE FUNCTION RESTEXT% ()
  10627.         DECLARE SUB SCROLLDN (BYVAL X1%, BYVAL Y1%, BYVAL X2%, BYVAL
  10628.            Y2%, BYVAL Num%, BYVAL Colr%)
  10629.         DECLARE SUB SCROLLLT (BYVAL X1%, BYVAL Y1%, BYVAL X2%, BYVAL
  10630.            Y2%, BYVAL Num%, BYVAL Colr%)
  10631.         DECLARE SUB SCROLLRT (BYVAL X1%, BYVAL Y1%, BYVAL X2%, BYVAL
  10632.            Y2%, BYVAL Num%, BYVAL Colr%)
  10633.         DECLARE SUB SCROLLUP (BYVAL X1%, BYVAL Y1%, BYVAL X2%, BYVAL
  10634.            Y2%, BYVAL Num%, BYVAL Colr%)
  10635.         DECLARE SUB SDELAY (BYVAL Count%)
  10636.         DECLARE SUB SETCARD (BYVAL CHIP%, BYVAL MEM%)
  10637.         DECLARE SUB SETVIEW (BYVAL X1%, BYVAL Y1%, BYVAL X2%, BYVAL
  10638.            Y2%)
  10639.         DECLARE SUB SPRITEGAP (BYVAL TransColr%, BYVAL X%, BYVAL Y%,
  10640.            SEG SpriteGfxBlk%, SEG BkgndGfxBlk%)
  10641.         DECLARE SUB SPRITEGET (BYVAL TransColr%, BYVAL X%, BYVAL Y%,
  10642.            SEG SpriteGfxBlk%, SEG BkgndGfxBlk%)
  10643.         DECLARE SUB SPRITEPUT (BYVAL Mode%, BYVAL TransColr%, BYVAL
  10644.            X%, BYVAL Y%, SEG SpriteGfxBlk%)
  10645.         DECLARE FUNCTION SPRITECOLLDETECT% (BYVAL TransColr%, BYVAL
  10646.            Sprite1LocX%, BYVAL Sprite1LocY%, BYVAL Sprite2LocX%, BYVAL
  10647.            Sprite2LocY%, SEG Sprite1GfxBlk%, SEG Sprite2GfxBlk%)
  10648.         DECLARE FUNCTION VIDEOMODEGET% ()
  10649.         DECLARE SUB VIDEOMODESET (BYVAL Mode%)
  10650.         DECLARE SUB VIDEOOFF ()
  10651.         DECLARE SUB VIDEOON ()
  10652.         DECLARE FUNCTION WHICHCPU% ()
  10653.         DECLARE FUNCTION WHICHJOYSTICK% ()
  10654.         DECLARE FUNCTION WHICHMEM% ()
  10655.         DECLARE FUNCTION WHICHMOUSE% ()
  10656.         DECLARE FUNCTION WHICHVGA% ()
  10657.         DECLARE FUNCTION WHICHXMS% (SEG XmsKbytesAvailable%, SEG
  10658.            XmsHandlesAvailable%)
  10659.         DECLARE FUNCTION XMSALLOCATE% (BYVAL ReqKbytesOfMem%)
  10660.         DECLARE FUNCTION XMSERROR% ()
  10661.         DECLARE FUNCTION XMSFREE% (BYVAL XmsHandle%)
  10662.         DECLARE FUNCTION XMSGET% (BYVAL XmsHandle%, BYVAL
  10663.            OffsetIntoXms&, SEG DestVar%, BYVAL NumOfBytes&)
  10664.         DECLARE FUNCTION XMSPUT% (SEG SourceVar%, BYVAL XmsHandle%,
  10665.            BYVAL OffsetIntoXms&,  BYVAL NumOfBytes&)
  10666.         DECLARE FUNCTION XMSCOPY% (BYVAL XmsHandle1%, BYVAL
  10667.            OffsetIntoXms1&, BYVAL XmsHandle2%, BYVAL OffsetIntoXms2&,
  10668.            BYVAL NumOfBytes&)
  10669.  
  10670.         REM $DYNAMIC
  10671.  
  10672.  
  10673.  
  10674.                                     165
  10675.  
  10676.  
  10677.  
  10678.  
  10679.  
  10680.  
  10681.       APPENDIX B.  JOYSTICK PORTS AND Y-CABLES
  10682.  
  10683.       SCHEMATIC WIRING DIAGRAM FOR A STANDARD JOYSTICK PORT
  10684.  
  10685.                     DB15 male
  10686.                     connector
  10687.            Joystick B            ___       Joystick A
  10688.                       __/   |
  10689.                      /    o | 1 -------------------+
  10690.          +------------------  9 | o     |     ___Button A      |
  10691.          |     Button A___      |     o | 2 --o o-+            |
  10692.          |           +-o o-- 10 | o     |         |    X Axis  |
  10693.          |  X Axis   |          |     o | 3 -------------+     |
  10694.          |     +------------ 11 | o     |         |      |     |
  10695.          |     |     |          |     o | 4 ------+      |     |
  10696.          +--/\/\/\   +------ 12 | o     |         |    /\/\/\--+
  10697.          |           |          |     o | 5       |            |
  10698.          |     +------------ 13 | o     |         |            |
  10699.          |     |     | ___      |     o | 6 -------------+     |
  10700.          |     |     +-o o-- 14 | o     |     ___ |      |     |
  10701.          |     |    Button B    |     o | 7 --o o-+      |     |
  10702.          |     |             15 | o     |   Button B   /\/\/\--+
  10703.          +--/\/\/\               \__  o | 8            Y Axis
  10704.            Y Axis                   \___|
  10705.  
  10706.       Notes:
  10707.  
  10708.       1)This diagram comes with NO warranties expressed or implied.
  10709.         It is provided for information only.  In no event shall
  10710.         Stephen L. Balkum, Daniel A. Sill or Zephyr Software be held
  10711.         liable for damages resulting from use, misuse, or inability to
  10712.         use this information.
  10713.  
  10714.       2)The x and y axis potentiometers have a typical range of 0 to
  10715.         100k ohms.  Buttons are normally open and close when pressed.
  10716.  
  10717.       3)This diagram is correct for joystick ports that conform to the
  10718.         standard set forth by IBM. Some specialty joystick cards
  10719.         provide separate A and B joystick connectors.  For these
  10720.         cards, both connectors are wired to pins 1 through 8 as shown
  10721.         in the diagram.
  10722.  
  10723.       4)Many 'Super I/O' boards (2H/2F/2S/1P/1G) equipped with a
  10724.         joystick port will support only one joystick.  On these cards,
  10725.         pins 9 through 15 are not used.
  10726.  
  10727.       5)Commercially available joysticks are wired to use pins 1
  10728.         through 8 and, therefore, will always be 'Joystick A' if
  10729.         plugged directly into a dual joystick port connector.
  10730.  
  10731.       6)Many sound cards provide joystick ports; however, their
  10732.         connector wiring does not always conform to the standard shown
  10733.         above.  Some of these connectors may be used for other
  10734.  
  10735.  
  10736.  
  10737.                                     166
  10738.  
  10739.  
  10740.  
  10741.  
  10742.  
  10743.  
  10744.         purposes such as a MIDI port.  See the documentation that
  10745.         comes with the sound card.
  10746.  
  10747.       7)If there is more than one joystick port on a computer
  10748.         configured to operate the same joystick, only ONE port should
  10749.         be enabled at any given time for proper operation.  Disable
  10750.         all but one joystick port.  For example, if the computer has
  10751.         both a Super I/O card and a sound card, the joystick port on
  10752.         the Super I/O card should be disabled since the sound card's
  10753.         port probably supports two joysticks and the I/O card supports
  10754.         only one.
  10755.  
  10756.  
  10757.  
  10758.  
  10759.  
  10760.  
  10761.  
  10762.  
  10763.  
  10764.  
  10765.  
  10766.  
  10767.  
  10768.  
  10769.  
  10770.  
  10771.  
  10772.  
  10773.  
  10774.  
  10775.  
  10776.  
  10777.  
  10778.  
  10779.  
  10780.  
  10781.  
  10782.  
  10783.  
  10784.  
  10785.  
  10786.  
  10787.  
  10788.  
  10789.  
  10790.  
  10791.  
  10792.  
  10793.  
  10794.  
  10795.  
  10796.  
  10797.  
  10798.  
  10799.  
  10800.                                     167
  10801.  
  10802.  
  10803.  
  10804.  
  10805.  
  10806.  
  10807.       SCHEMATIC WIRING DIAGRAM FOR A JOYSTICK Y-CABLE
  10808.                           ___
  10809.              DB15 male         __/   |
  10810.                connector to       /    o | 1 --------+
  10811.                Joystick Port   9 | o     |           |
  10812.             on computer      |     o | 2 --------|-+
  10813.                 +-------- 10 | o     |           | |
  10814.                 |            |     o | 3 --------|-|-+
  10815.                 | +------ 11 | o     |           | | |
  10816.                 | |          |     o | 4 --------|-|-|-+
  10817.                 | |       12 | o     |           | | | |
  10818.                 | |          |     o | 5         | | | |
  10819.                 | | +---- 13 | o     |           | | | |
  10820.                 | | |        |     o | 6 --------|-|-|-|-+
  10821.                 | | | +-- 14 | o     |           | | | | |
  10822.                 | | | |      |     o | 7 --------|-|-|-|-|-+
  10823.                 | | | |   15 | o     |           | | | | | |
  10824.                 | | | |       \__  o | 8         | | | | | |
  10825.                 | | | |          \___|           | | | | | |
  10826.                 | | | |                          | | | | | |
  10827.                 | | | |                          | | | | | |
  10828.                 | | | |  +-----------------------+ | | | | |
  10829.                 | | | |  |                       | | | | | |
  10830.                 | | | |  | +---------------------|-|-|-+ | |
  10831.                 | | | |  | |                     | | | | | |
  10832.                 | | | |  | |                     | | | | | |
  10833.        DB15 female      | | | |  | |     DB15 female     | | | | | |
  10834.        connector to     | | | |  | |     connector to    | | | | | |
  10835.         Joystick B      | | | |  | |      Joystick A     | | | | | |
  10836.           ___       | | | |  | |            ___      | | | | | |
  10837.            __/   |      | | | |  | |         __/   |     | | | | | |
  10838.           /    o | 1 ---|-|-|-|--+ |        /    o | 1 --+ | | | | |
  10839.        9 | o     |      | | | |    |     9 | o     |       | | | | |
  10840.          |     o | 2 ---+ | | |    |       |     o | 2 ----+ | | | |
  10841.       10 | o     |        | | |    |    10 | o     |         | | | |
  10842.          |     o | 3 -----+ | |    |       |     o | 3 ------+ | | |
  10843.       11 | o     |          | |    |    11 | o     |           | | |
  10844.          |     o | 4 -------|-|----+       |     o | 4 --------+ | |
  10845.       12 | o     |          | |         12 | o     |             | |
  10846.          |     o | 5        | |            |     o | 5           | |
  10847.       13 | o     |          | |         13 | o     |             | |
  10848.          |     o | 6 -------+ |            |     o | 6 ----------+ |
  10849.       14 | o     |            |         14 | o     |               |
  10850.          |     o | 7 ---------+            |     o | 7 ------------+
  10851.       15 | o     |                      15 | o     |
  10852.           \__  o | 8                        \__  o | 8
  10853.          \___|                             \___|
  10854.  
  10855.       Notes:
  10856.  
  10857.       1)This diagram comes with NO warranties expressed or implied.
  10858.         It is provided for information only.  In no event shall
  10859.         Stephen L. Balkum, Daniel A. Sill or Zephyr Software be held
  10860.  
  10861.  
  10862.  
  10863.                                     168
  10864.  
  10865.  
  10866.  
  10867.  
  10868.  
  10869.  
  10870.         liable for damages resulting from use, misuse, or inability to
  10871.         use this information.
  10872.  
  10873.       2)This cable has worked with a standard joystick port connector,
  10874.         a Sound Blaster port connector, and a Sound Blaster Pro
  10875.         joystick port connector.
  10876.  
  10877.  
  10878.  
  10879.  
  10880.  
  10881.  
  10882.  
  10883.  
  10884.  
  10885.  
  10886.  
  10887.  
  10888.  
  10889.  
  10890.  
  10891.  
  10892.  
  10893.  
  10894.  
  10895.  
  10896.  
  10897.  
  10898.  
  10899.  
  10900.  
  10901.  
  10902.  
  10903.  
  10904.  
  10905.  
  10906.  
  10907.  
  10908.  
  10909.  
  10910.  
  10911.  
  10912.  
  10913.  
  10914.  
  10915.  
  10916.  
  10917.  
  10918.  
  10919.  
  10920.  
  10921.  
  10922.  
  10923.  
  10924.  
  10925.  
  10926.                                     169
  10927.  
  10928.